diff options
author | Silas Bartha <[email protected]> | 2024-09-09 21:29:49 -0400 |
---|---|---|
committer | Silas Bartha <[email protected]> | 2024-09-09 21:29:49 -0400 |
commit | a5e8a554b55e14e74614c45eee43fdff7fd6fcb5 (patch) | |
tree | 7d3dfe495b829c32037a9a93328a3d6f480686c6 | |
parent | 85751864c0699fb9834b3cc9ff90eb39b5b75ff2 (diff) |
Kill task when channel closed
-rw-r--r-- | src/assets.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/assets.rs b/src/assets.rs index 2d2206c..8aab74d 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -3,7 +3,7 @@ use std::{ sync::Arc, }; -use async_channel::{Receiver, TryRecvError}; +use async_channel::{Receiver, SendError, TryRecvError, TrySendError}; use bevy::{ asset::{io::Reader, AssetLoader, AsyncReadExt, LoadContext}, audio::Source, @@ -77,8 +77,8 @@ impl MidiDecoder { while !sequencer.end_of_sequence() { sequencer.render(&mut left, &mut right); for value in left.iter().interleave(right.iter()) { - if let Err(e) = tx.send(*value).await { - error!("{e}"); + if let Err(_) = tx.send(*value).await { + return; }; } } |