question 456 Reliable Data Pipelines · medium
A retried batch doubles the totals
apply_batch adds a batch of push events to the running commit totals per repository and remembers the batch ID in applied, so the scheduler can safely retry. Yet after a retry the dashboard shows double the commits. Find the bug and fix it, so applying a batch that was already applied changes nothing and returns False, and applying a new batch updates the totals and returns True.
Function
apply_batch(totals, applied, batch_id, events); updates totals (repo → commits) and the list applied in placeReturns
True when the batch was applied by this call, False when it had been applied beforeRulethe ID of an applied batch appears in
applied exactly once