Release unfinished events when a BroadcastQueue subscriber is removed - #846
Open
DeepanshuPal wants to merge 4 commits into
Open
DeepanshuPal wants to merge 4 commits into
DeepanshuPal wants to merge 4 commits into
Conversation
Add release method to mark unfinished tasks as done.
Added unit tests for BroadcastQueue subscriber removal behavior, ensuring proper handling of joins and unsubscribes.
DeepanshuPal
requested review from
changt,
cloudwebrtc,
lukasIO and
xianshijing-lk
as code owners
October 2, 2026 17:09
This branch has not been deployed
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.
Fixes #827.
Room._listen_taskcallsBroadcastQueue.join()after each event.BroadcastQueue.unsubscribe()removed the subscriber's queue from_subscribers, but ajoin()already waiting on that queue kept waiting for events nobody would finish. Whenpublish_track()is cancelled, its subscriber goes away mid-event and the room listener hangs, so no further room events are delivered.This adds
Queue.release(), which marks every unfinished item as done, and calls it fromunsubscribe(). It covers events still queued and events the subscriber took withget()but nevertask_done()d.Tests:
livekit-rtc/tests/test_broadcast_queue.py(5 tests). 3 fail without the change (a join stays stuck after unsubscribe, with the event queued or already taken, and a surviving subscriber case), all 5 pass with it.Disclosure: I used AI assistance to write this. I ran the tests locally before opening the PR.