Ruthwik/hosted/single session#3127
Draft
ruthwikdasyam wants to merge 3 commits into
Draft
Conversation
A broker session is a single RTCPeerConnection and so lives in one process; the provider is a per-process singleton, so broker-bound modules spread across worker processes each opened their own session (the operator only ever reaches one, leaving the rest dead). Blueprints worked around this by hand-pinning all broker-bound modules into one worker. Instead, the workers self-elect a single session owner via a machine-local flock keyed on BrokerConfig + DIMOS_RUN_ID (no coordinator involvement). The owner runs the real BrokerProvider plus a SessionRelay; every other worker resolves to a ProxyBrokerProvider that forwards publish/subscribe/video over a shared-memory session bus to the owner. Result: exactly one CF session per blueprint for any n_workers, with the transport/blueprint API unchanged. - session_bus.py: SHM bridge (session-keyed subjects; reliable CpuShmQueue for the control plane, latest-wins for lossy channels, frame subject for video). - broker_proxy.py: ProxyBrokerProvider, SessionRelay, elect_session_owner. - broker.py: BrokerConfig._create() self-elects; _OwnerBrokerProvider runs the relay and holds the ownership lock over the provider lifecycle.
…lag single-host election
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #3127 +/- ##
==========================================
+ Coverage 72.56% 73.16% +0.60%
==========================================
Files 1025 1035 +10
Lines 92256 94071 +1815
Branches 8425 8617 +192
==========================================
+ Hits 66941 68829 +1888
+ Misses 23013 22900 -113
- Partials 2302 2342 +40
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 47 files with indirect coverage changes 🚀 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.
Contribution path
Problem
Solution
How to Test
AI assistance
Checklist