Added non-panic error handling for the sink
This commit is contained in:
parent
1f3ec2bf39
commit
81746dd5dc
17
src/main.rs
17
src/main.rs
|
@ -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
|
||||
.sink_map_err(|e| Box::new(e) as Box<dyn Error>)
|
||||
.send_all(&mut model)
|
||||
.await
|
||||
.expect("Broken buffer");
|
||||
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
|
||||
{
|
||||
// Idk what to do here, remake stream? what? idk, im not rustie
|
||||
println!("got error on sender stream: {}", err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
publisher
|
||||
|
|
Loading…
Reference in New Issue