Repository navigation
fix: clear the cancel_timeout timer once a canceled sql.batch settles - #1318
Merged
Merged
Conversation
The unanswered timer set by cancel() was cleared before the batch query itself settled, so it stayed armed for cancel_timeout and kept the process alive.
Owner
|
Uh nice - thanks Alex... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1317
Canceling a
sql.batchleft acancel_timeouttimer armed after the batch had already rejected with57014, so the process stayed alive forcancel_timeoutseconds (andsql.end()was not the cause). A plain query did not have the problem.cancel()armsx.unansweredthroughexpect(x).settle(x)callsanswered(x)first, andansweredonly clears the timer whenx.batch.query.settled. For a batch, the batch query is settled later in the samesettlecall (batched→query.reject), so the check always saw an unsettled query and the timer was never cleared.settlenow callsanswered(x)again for batch exchanges after settling.tests/unit/cancel.jsruns a canceledsql.batchagainst the simulated server and checks that no timers remain pending after the rejection. It fails before the change (1 pending timer at 5100 ms) and passes after. The unit suite andnode tests/simulate.js(2000 seeds) pass.This change was prepared, and the tests above were run, with the assistance of an AI coding tool.