Added non-panic error handling for the sink

This commit is contained in:
Emile 2021-07-11 00:32:44 +01:00
parent 1f3ec2bf39
commit 81746dd5dc
1 changed files with 12 additions and 5 deletions

View File

@ -130,11 +130,18 @@ async fn main() -> Result<(), Box<dyn Error>> {
.map_err(|e| Box::new(e) as Box<dyn Error>);
tokio::spawn(async move {
sender
loop {
if let Err(err) = sender
.clone() // Does this even make sense??? Can you clone a sender?? am i fucked now??
// shouldnt it be re-init'd?
.sink_map_err(|e| Box::new(e) as Box<dyn Error>)
.send_all(&mut model)
.await
.expect("Broken buffer");
{
// Idk what to do here, remake stream? what? idk, im not rustie
println!("got error on sender stream: {}", err);
}
}
});
publisher