Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def get(self):
counter = model.Counter.get_unfinished_or_create(
self.repo, self.SCAN_NAME)
entities_remaining = True
while entities_remaining:
batches_done = 0
while entities_remaining and batches_done < 20:
# Batch the db updates.
for _ in xrange(100):
entities_remaining = run_count(
Expand All @@ -185,6 +186,9 @@ def get(self):
break
# And put the updates at once.
counter.put()
batches_done += 1
self.add_task_for_repo(self.repo, self.SCAN_NAME, self.ACTION)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand this change -- I get the limit on the batching, but why do you now call add_task_for_repo where you didn't before?

return
except runtime.DeadlineExceededError:
# Continue counting in another task.
self.add_task_for_repo(self.repo, self.SCAN_NAME, self.ACTION)
Expand Down