runtime
496 / 500
question 496 Production Readiness Capstone · medium

One batch missing after every restart

Operations noticed that whenever the nightly job is restarted after a crash, exactly one batch of trips never reaches the report, and the written count in the morning summary is one too high. Find and fix the bugs in resume_night.

Functionresume_night(batches, sink, state); state is {"done": n} (batches already written)
Behaviourwrite batches state["done"] onward with sink.write(batch), setting state["done"] to number + 1 after each write
Returnsthe number of batches written by this call

Loading your progress…

One batch missing after every restart — Python practice · Runtime