improve code for obs

This commit is contained in:
houseme
2025-04-09 15:12:31 +08:00
parent dd5d84cc42
commit a07ca8ae81
17 changed files with 26 additions and 15 deletions
+13
View File
@@ -0,0 +1,13 @@
use crate::{sink::Sink, UnifiedLogEntry};
use std::sync::Arc;
use tokio::sync::mpsc::Receiver;
/// Start the log processing worker thread
pub async fn start_worker(receiver: Receiver<UnifiedLogEntry>, sinks: Vec<Arc<dyn Sink>>) {
let mut receiver = receiver;
while let Some(entry) = receiver.recv().await {
for sink in &sinks {
sink.write(&entry).await;
}
}
}