Don't panic if events are lagged
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
244eea66eb
commit
cf9a7a02ef
@ -7,7 +7,7 @@ use tokio::{
|
|||||||
sync::{broadcast, oneshot},
|
sync::{broadcast, oneshot},
|
||||||
task::JoinHandle,
|
task::JoinHandle,
|
||||||
};
|
};
|
||||||
use tracing::{trace, trace_span};
|
use tracing::{trace, trace_span, warn};
|
||||||
use tracing_futures::Instrument;
|
use tracing_futures::Instrument;
|
||||||
|
|
||||||
struct UpdateListenerTask {
|
struct UpdateListenerTask {
|
||||||
@ -21,13 +21,17 @@ impl UpdateListenerTask {
|
|||||||
event: Result<SectionEvent, broadcast::RecvError>,
|
event: Result<SectionEvent, broadcast::RecvError>,
|
||||||
) -> eyre::Result<()> {
|
) -> eyre::Result<()> {
|
||||||
let event = match event {
|
let event = match event {
|
||||||
|
Ok(ev) => ev,
|
||||||
Err(broadcast::RecvError::Closed) => {
|
Err(broadcast::RecvError::Closed) => {
|
||||||
trace!("section events channel closed");
|
trace!("section events channel closed");
|
||||||
self.running = false;
|
self.running = false;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
e => e,
|
Err(broadcast::RecvError::Lagged(n)) => {
|
||||||
}?;
|
warn!("section events lagged by {}", n);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
};
|
||||||
if let Some((sec_id, state)) = match event {
|
if let Some((sec_id, state)) = match event {
|
||||||
SectionEvent::RunStart(_, sec) | SectionEvent::RunUnpause(_, sec) => {
|
SectionEvent::RunStart(_, sec) | SectionEvent::RunUnpause(_, sec) => {
|
||||||
Some((sec.id, true))
|
Some((sec.id, true))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user