fix: make artifact signature wait context-aware to allow graceful shutdown#6329
Merged
evankanderson merged 3 commits intomindersec:mainfrom Apr 11, 2026
Merged
Conversation
evankanderson
approved these changes
Apr 11, 2026
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
This change replaces the blocking
time.Sleepused during artifact entity processing with a context-aware wait.Currently, the handler unconditionally waits for
ArtifactSignatureWaitPeriod(10 seconds) before proceeding with evaluation of artifact entities. This is implemented usingtime.Sleep, which does not respect context cancellation. As a result, if the server is shutting down and the parent context is cancelled, goroutines remain blocked for the full duration, delaying graceful shutdown.This PR updates the logic to use a
selectstatement overtime.AfterandmsgCtx.Done(). This allows the goroutine to exit early when the context is cancelled, while preserving the intended wait behavior during normal execution.The fix leverages the existing
msgCtx, which is already tied to the handler’s shutdown lifecycle, keeping the change minimal and aligned with current design.No additional dependencies are introduced.
Fixes #6324
Testing
Steps to Reproduce
ENTITY_ARTIFACTS).Behavior Before Fix
Behavior After Fix
Additional Verification
ArtifactSignatureWaitPeriodwhen no shutdown occurs.