Commit 0c81c0d
Wake outbox loop on stop() to avoid ~1s shutdown delay (#5805)
### Motivation
`Outbox.stop()` sets `_should_stop` but doesn't wake the loop when it is
sleeping in `Event.wait(timeout=1.0)`. The loop only checks
`_should_stop` at the top of the while loop, so after `stop()` is called
the outbox loop lingers for up to 1 second until the `Event.wait` times
out.
This is a resource hygiene issue: deleted clients' outbox loops should
stop promptly rather than lingering. The linger is concurrent (nothing
awaits the outbox task after `stop()`), so it does not block the caller.
But it leaves unnecessary background tasks in the event loop and extends
the cleanup window that test harnesses or diagnostic tooling must
account for.
Closes #5804
### Implementation
`Outbox.stop()` now calls `self._set_enqueue_event()` after setting
`_should_stop = True`. This is the same helper already used by
`enqueue_update()`, `enqueue_delete()`, `enqueue_message()`, and
`try_rewind()` to wake the loop — so the fix follows the existing
pattern rather than introducing anything new. The loop wakes, sees
`_should_stop` is true, and exits immediately.
### Progress
- [X] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [X] The implementation is complete.
- [X] If this PR addresses a security issue, it has been coordinated via
the [security
advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [X] Pytests have been added (or are not necessary).
- [X] Documentation has been added (or is not necessary).
---------
Co-authored-by: Brian Ballsun-Stanton <denubisx@noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Falko Schindler <falko@zauberzeug.com>
Co-authored-by: Brian Ballsun-Stanton <denubis@noreply.github.com>1 parent 2534a08 commit 0c81c0d
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
0 commit comments