Fix batch events counting

This commit is contained in:
allegroai 2021-01-05 17:37:40 +02:00
parent 018582ff8a
commit eb4c9f0b13

View File

@ -206,7 +206,7 @@ class EventBLL(object):
) as it: ) as it:
for success, info in it: for success, info in it:
if success: if success:
added += chunk_size added += 1
else: else:
errors_per_type["Error when indexing events batch"] += 1 errors_per_type["Error when indexing events batch"] += 1
@ -233,9 +233,6 @@ class EventBLL(object):
remaining_tasks, company_id, last_update=now remaining_tasks, company_id, last_update=now
) )
# Compensate for always adding chunk_size on success (last chunk is probably smaller)
added = min(added, len(actions))
if not added: if not added:
raise errors.bad_request.EventsNotAdded(**errors_per_type) raise errors.bad_request.EventsNotAdded(**errors_per_type)