Cleanup old subscribers
This commit is contained in:
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 {
|
||||
|
||||
@@ -27,6 +27,7 @@ impl BcCamera {
|
||||
|
||||
sub_ping.recv().await?;
|
||||
|
||||
log::trace!("Ping complete");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user