Skip to content

Commit

Permalink
bug fix message queue oveflow
Browse files Browse the repository at this point in the history
  • Loading branch information
abamaxa committed Jan 31, 2024
2 parents 67efeb0 + 7a4a8ed commit bcb7395
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tvserver"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
authors = ["Chris Morgan <cmorgan@abamaxa.com>"]
repository = "https://github.com/abamaxa/tvserver"
Expand Down
4 changes: 1 addition & 3 deletions src/domain/messagebus/message_exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct MessageExchange {
sender: mpsc::Sender<ReceivedRemoteMessage>,
receiver: broadcast::Sender<ReceivedRemoteMessage>,
local_sender: LocalMessageSender,
_local_receiver: Arc<LocalMessageReceiver>,
}

impl MessageExchange {
Expand Down Expand Up @@ -55,7 +54,7 @@ impl MessageExchange {
})(client_map.clone(), in_tx.clone()),
);

let (local_sender, local_receiver) = broadcast::channel::<LocalMessage>(100);
let (local_sender, _) = broadcast::channel::<LocalMessage>(100);

let _ = tokio::spawn((|client_map: ClientMap| async move {
loop {
Expand All @@ -66,7 +65,6 @@ impl MessageExchange {
let exchanger = Self {
client_map: client_map.clone(),
receiver: in_tx,
_local_receiver: Arc::new(local_receiver),
sender,
local_sender,
};
Expand Down
4 changes: 4 additions & 0 deletions src/services/media_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ impl MediaStore {
}

fn store_video_info(&self, path: &Path) {
if self.sender.len() >= 100 {
tracing::info!("local queue has more than 100 entries, will process {:?} later", path);
return;
}
let event = MediaEvent::new_media(path, None);

if let Err(e) = self.sender.send(LocalMessage::Media(event)) {
Expand Down
2 changes: 1 addition & 1 deletion src/services/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Monitor {
tracing::error!("error checking video info: {}", err);
}

sleep(Duration::from_secs(3)).await;
sleep(Duration::from_secs(10)).await;
}
})
}
Expand Down

0 comments on commit bcb7395

Please sign in to comment.