mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-04-19 19:34:24 +02:00
fix: do not panic on full channels
This commit is contained in:
parent
cc39896181
commit
061663392e
1 changed files with 11 additions and 2 deletions
|
@ -62,8 +62,17 @@ macro_rules! glib_recv {
|
|||
glib::spawn_future_local(async move {
|
||||
// re-delcare in case ie `context.subscribe()` is passed directly
|
||||
let mut rx = $rx;
|
||||
while let Ok($val) = rx.recv().await {
|
||||
$expr
|
||||
loop {
|
||||
match rx.recv().await {
|
||||
Ok($val) => $expr,
|
||||
Err(tokio::sync::broadcast::error::RecvError::Lagged(count)) => {
|
||||
tracing::warn!("Channel lagged behind by {count}, this may result in unexpected or broken behaviour");
|
||||
}
|
||||
Err(err) => {
|
||||
tracing::error!("{err:?}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}};
|
||||
|
|
Loading…
Add table
Reference in a new issue