Cleanup old subscribers

This commit is contained in:
QuantumEntangledAndy committed 2023-08-14 18:42:15 +07:00
1 parent 97703bdb38
commit 1cde5ec3e5
2 files changed
+10

No files matched your search

@@ -193,6 +193,15 @@ impl Poller {
async fn run(&mut self) -> Result<()> {
while let Some(command) = self.reciever.next().await {
yield_now().await;
// Clean Up subscribers
self.subscribers
.num
.iter_mut()
.for_each(|(_, channels)| channels.retain(|_, channel| !channel.is_closed()));
self.subscribers
.num
.retain(|_, channels| !channels.is_empty());
// Handle the command
match command {
PollCommand::Bc(boxed_response) => {
match *boxed_response {
+1
View File
@@ -27,6 +27,7 @@ impl BcCamera {
sub_ping.recv().await?;
log::trace!("Ping complete");
Ok(())
}
}