mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-01 10:41:03 +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 {
|
glib::spawn_future_local(async move {
|
||||||
// re-delcare in case ie `context.subscribe()` is passed directly
|
// re-delcare in case ie `context.subscribe()` is passed directly
|
||||||
let mut rx = $rx;
|
let mut rx = $rx;
|
||||||
while let Ok($val) = rx.recv().await {
|
loop {
|
||||||
$expr
|
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
Add a link
Reference in a new issue