Skip to content

Commit

Permalink
fix: did not send data
Browse files Browse the repository at this point in the history
  • Loading branch information
ImSoZRious committed Jul 7, 2023
1 parent 6b32a1b commit 31cb6ff
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/replayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@ impl<T> Replayer<T> {
rx
}

pub async fn add_data(&self, data: T) {
self.data.write().await.push(data);
pub async fn add_data(&self, data: T)
where
T: Send + Sync + Clone + 'static
{
self.data.write().await.push(data.clone());

let all_tx = self.txs.read().await.clone();

for mut tx in all_tx.into_iter() {
if let Err(e) = tx.send(data.clone()).await {
tracing::warn!("Unable to send data: {e}");
}
}
}
}

0 comments on commit 31cb6ff

Please sign in to comment.