Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Fix bulk disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
feymartynov committed Jan 28, 2021
1 parent c1a7058 commit 7338a91
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/endpoint/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,21 @@ impl EventHandler for DeleteHandler {
.active(true)
.execute(&conn)?;

let mut is_publisher = false;

for stream in streams.iter() {
// If the agent is a publisher.
if stream.sent_by() == &payload.subject {
// Stop the stream.
db::janus_rtc_stream::stop(stream.id(), &conn)?;
is_publisher = true;
}
}

// Disconnect stream readers since the stream has gone.
db::agent_connection::BulkDisconnectByRoomQuery::new(room_id).execute(&conn)?;
if is_publisher {
db::agent_connection::BulkDisconnectByRoomQuery::new(room_id).execute(&conn)?;
}

// Send agent.leave requests to those backends where the agent is connected to.
let mut backend_ids = streams
Expand Down

0 comments on commit 7338a91

Please sign in to comment.