fix(polling): no-operations sync response caused hot spin that ignored abort - #223
Open
nezumi0627 wants to merge 1 commit into
Open
fix(polling): no-operations sync response caused hot spin that ignored abort#223nezumi0627 wants to merge 1 commit into
nezumi0627 wants to merge 1 commit into
Conversation
…ned no operations
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.
Summary
Polling._listenTalkEvents(the deprecated but still exported polling generator) busy-looped whenever a sync response arrived withoutoperationResponse.operations, which happens routinely (e.g. full-sync-only responses):The
continuejumped back towhile (true)without executingawait sleep(pollingInterval)orif (signal?.aborted) break. Consequences:talk.syncwas hammered as fast as the event loop allowed (rate-limit / ban risk),AbortSignalcould never stop the loop, because abort is only checked after the sleep.Fix
Replace the early
continuewith a positive condition around the operations loop so every iteration falls through to the shared sleep/abort tail.Testing
New
mod.test.ts: stubstalk.syncto resolve{}(no operations), polls with a 50 ms interval, aborts after 150 ms. Asserts the poll count stays bounded and the loop actually terminates. On the old code this test never completes — the abort is ignored and syncCalls explodes.Full suite:
deno test --allow-allpasses.