fix(scheduler): clean up started sources when startup fails - #672
Open
stupidprogrammer4 wants to merge 1 commit into
Open
stupidprogrammer4 wants to merge 1 commit into
stupidprogrammer4 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #672 +/- ##
==========================================
+ Coverage 82.63% 82.71% +0.07%
==========================================
Files 69 69
Lines 2730 2742 +12
==========================================
+ Hits 2256 2268 +12
Misses 474 474 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
When source A starts successfully and source B raises during
run_scheduler()startup, A'sshutdown()hook is never called. The same omission occurs if all sources start but scheduler/broker startup fails.Track sources whose startup completed and shut them down in reverse order on startup failure or cancellation. Log individual cleanup failures, continue closing the remaining started sources, and re-raise the original startup exception. Do not call shutdown on the source or scheduler whose startup failed. Normal loop cancellation and shutdown ordering are preserved.
Validation:
c4b8666checkout; the two boundary/normal-shutdown cases already pass.uv.lockwith all extras:pytest -q -n 2 --tb=short— 355 passed.This fixes a missing lifecycle callback; no production leak or data loss is claimed. A component remains responsible for resources acquired during its own failed startup. Scheduler-loop errors and draining running tasks are outside this change; #671 addresses loop-owned task draining separately.