-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: skip unavailable WebUI startup #8800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,7 @@ async def main_async(webui_dir_arg: str | None) -> None: | |
|
|
||
| core_lifecycle = InitialLoader(db, log_broker) | ||
| core_lifecycle.webui_dir = webui_dir | ||
| core_lifecycle.webui_available = webui_dir is not None | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你好,我简单看了这行代码,想问一下:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right that The intended split is:
So this line is safe only with that |
||
| await core_lifecycle.start() | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
webui_availableisFalse, thecore_taskis awaited directly without being wrapped in atry...except asyncio.CancelledErrorblock. This means if the application is cancelled or shut down during this time, theCancelledErrorwill propagate immediately, andcore_lifecycle.stop()will never be called. This prevents proper cleanup of resources, database connections, and plugin termination.Wrapping the await in a
try...exceptblock ensures thatstop()is always called upon cancellation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I pushed
92335ce16to give the no-WebUI path the same cancellation cleanup as the dashboard path: ifcore_taskis cancelled,core_lifecycle.stop()is awaited before returning.Focused validation:
tests/test_main.pynow includes a cancellation regression for this branch.