lib/eco/api/microcases/people_search.rb in eco-helpers-2.7.18 vs lib/eco/api/microcases/people_search.rb in eco-helpers-2.7.19
- old
+ new
@@ -11,9 +11,11 @@
# @param silent [Boolean] `false` if low level search messages should be shown.
# @return [Eco::API::Organization::People] the `People` object with the found persons.
def people_search(data, options: {}, silent: true) # rubocop:disable Metrics/AbcSize
session.logger.info("Going to api get #{data.length} entries...")
+ silent = silent && data.count <= 500
+
start = Time.now
people = session.batch.search(data, silent: silent).then do |status|
secs = (Time.now - start).round(3)
Eco::API::Organization::People.new(status.people).tap do |people| # rubocop:disable Lint/ShadowingOuterLocalVariable
cnt = people.count