fix: propagate context for cancellable imports#803
Open
ashnaaseth2325-oss wants to merge 1 commit intoOneBusAway:mainfrom
Open
fix: propagate context for cancellable imports#803ashnaaseth2325-oss wants to merge 1 commit intoOneBusAway:mainfrom
ashnaaseth2325-oss wants to merge 1 commit intoOneBusAway:mainfrom
Conversation
Replace hardcoded context.Background() with the caller-supplied context so in-flight DB imports can be cancelled on shutdown or timeout. Signed-off-by: ashnaaseth2325-oss <ashnaaseth2325@gmail.com>
Contributor
Author
|
Hello @aaronbrethorst |
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 PR fixes a context propagation issue in the GTFS import flow that prevented database operations from being cancellable during shutdown. The change ensures the caller’s
context.Contextis properly passed through instead of being overridden.Primary changes are in
gtfsdb/helpers.goandgtfsdb/client.go, specifically aroundprocessAndStoreGTFSDataWithSourceand its callers.FIX
VERIFICATION
Tested by triggering a GTFS import and sending a SIGTERM while it was still processing. Before this change, the app would hang for minutes waiting for the DB writes to finish. Now, the import cancels immediately and the service shuts down cleanly without delay.