fix: contain background runner store failures - #12
Open
charan-rathore wants to merge 1 commit into
Open
charan-rathore wants to merge 1 commit into
charan-rathore wants to merge 1 commit into
Conversation
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.
What this fixes
The runner's scheduler tick called
store.claim()outside the try block. If the store threw (for example a transient SQLite lock or error),tick()rejected. Because it runs from an immediate/interval callback and the server has nounhandledRejectionhandler, that rejection could take down the always-on server.Changes
finallystill clears the active slot and timers, even when persisting a failure also throws.Tests
Two regression tests for
claim()andfail()errors, plus an ownership timer test. They fail on the base commit and pass with the change. They use the real SQLite store and inject the exceptions, so they cover the failure paths deterministically. I did not test real lock contention.Results below are from the person who prepared the change; I did not rerun them. Full suite: 34 files, 159 tests pass. Lint, typecheck, format check and production build pass (the build prints a chunk size warning that was already there). No dependency changes.