Skip to content

fix(batch): stop a wait before a back-off that ends on its --timeout - #76

Merged
StefanoGuerrini merged 1 commit into
mainfrom
fix/batch-wait-deadline
Oct 30, 2026
Merged

StefanoGuerrini merged 1 commit into
mainfrom
fix/batch-wait-deadline

Conversation

@zenrows-dev-pool

Copy link
Copy Markdown
Contributor

What

zenrows batch wait no longer sleeps through a back-off that ends exactly on --timeout.

  • waitForJob stopped only when the next back-off ended after the deadline. A back-off ending on it was slept in full, and the job was then read with no time left.
  • It now stops when the back-off would reach the deadline, the same rule the retry inside each read already uses.

Why

Whether that edge case happened depended on whether a millisecond passed between reads. So the test "a wait never sleeps or retries past its --timeout" failed now and then, on main too (sleeps: 2000,3000).

How it is checked

  • A new test moves a fake clock only by each sleep. Before the fix it fails with sleeps: 2000,3000; after it, the wait sleeps once.
  • npm run typecheck is clean, and npm test passes 495 of 495, five runs in a row.

waitForJob slept whenever the next back-off ended at or before the deadline,
so a back-off ending exactly on it slept the whole way and then read the job
with no time left. Whether that happened depended on whether a millisecond
passed between reads, which made "a wait never sleeps or retries past its
--timeout" fail now and then. The wait now stops when the back-off would reach
the deadline, as the retry inside each read already does.
@StefanoGuerrini
StefanoGuerrini merged commit 090c75f into main Oct 30, 2026
3 checks passed
@StefanoGuerrini
StefanoGuerrini deleted the fix/batch-wait-deadline branch October 30, 2026 11:11
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant