fix(events): dispatch foreign loops through serving loop - #1603
Merged
debpalash merged 6 commits intoAug 20, 2026
Conversation
…-start' into fix/integration-eventbus-loop-clean # Conflicts: # CHANGELOG.md
…it' into fix/integration-eventbus-loop-clean
…-start' into fix/integration-eventbus-loop-clean
Contributor
|
| Filename | Overview |
|---|---|
| backend/core/event_bus.py | Foreign-loop emitters now schedule broadcasts thread-safely on the loop that owns listener queues and synchronization state. |
| backend/services/watermark.py | Adds a shared asynchronous watermark dispatcher that preserves successful audio when executor admission is closed during shutdown. |
| backend/services/model_manager.py | Distinguishes a live executor from one already shutting down when reopening watermark submissions for a lifespan. |
| backend/api/routers/generation.py | Replaces duplicated executor dispatch at finalization and streaming-preview sites with the shared watermark helper. |
| backend/api/routers/archetypes.py | Migrates archetype watermarking to the shared helper while retaining its existing bounded dispatch. |
| backend/api/routers/batch.py | Migrates whole-track batch watermarking to the shared dedicated-pool helper. |
| tests/test_event_bus_thread_emit.py | Adds deterministic coverage proving a producer on a foreign running loop reaches a listener owned by the serving loop. |
| tests/test_watermark_prefetch_coldstart.py | Extends bounded-shutdown coverage to verify asynchronous watermark dispatch returns completed audio unchanged while admission is closed. |
Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'contributo..." | Re-trigger Greptile
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
Tests
HF_HUB_OFFLINE=1 uv run --frozen pytest -q tests/test_event_bus_thread_emit.pyStacked on integration branch; do not merge independently to main.