Skip to content

Commit

Permalink
feat(1-3220): avoid an extra vec initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Jan 6, 2025
1 parent 54f4b93 commit 4dd3e24
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server/src/http/broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ impl Broadcaster {
async fn heartbeat(&self) {
let mut active_connections = 0i64;
for mut group in self.active_connections.iter_mut() {
let mut ok_clients = Vec::new();
let clients = std::mem::take(&mut group.clients);
let ok_clients = &mut group.clients;

for ClientData { token, sender } in clients {
if sender
Expand All @@ -138,7 +138,6 @@ impl Broadcaster {
}

active_connections += ok_clients.len() as i64;
group.clients = ok_clients;
}
CONNECTED_STREAMING_CLIENTS.set(active_connections)
}
Expand Down

0 comments on commit 4dd3e24

Please sign in to comment.