runtime
456 / 500
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.

Functionapply_batch(totals, applied, batch_id, events); updates totals (repo → commits) and the list applied in place
ReturnsTrue when the batch was applied by this call, False when it had been applied before
Rulethe ID of an applied batch appears in applied exactly once

Loading your progress…

A retried batch doubles the totals — Python practice · Runtime