fix: set errors on all commands when context is cancelled in Pipeline.Exec - #2
Open
pistakugli wants to merge 1 commit into
Open
fix: set errors on all commands when context is cancelled in Pipeline.Exec#2pistakugli wants to merge 1 commit into
pistakugli wants to merge 1 commit into
Conversation
….Exec When Pipeline.Exec is called with a pre-cancelled context, the commands in the queue now have their errors set to the context error before returning. This prevents: - Command accumulation on pipeline reuse - Memory leaks from unreferenced commands - Connection pollution from unclean state Also adds tests for context cancellation, pipeline reuse after cancellation, and deadline exceeded scenarios.
4 tasks
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.
Problem
When
Pipeline.Exec(ctx)is called with a pre-cancelled context, the commands in the queue don't have their errors set. This causes:Solution
Added a context check before execution. If the context is already cancelled, we set the context error on all commands and return immediately.
Changes
pipeline.go: Added context check inExec()that sets errors on all commands when context is pre-cancelledpipeline_test.go: Added 3 tests for context cancellation scenariosTests
context.Cancelederrorcontext.DeadlineExceededis handledAcceptance Criteria
Pipeline.Exec(ctx)guarantees that the internal command queue is cleared on all exit pathsWallet: 0xb7419c92b1d93251c0c85b756b390b29ab8162e0 (Polygon)