node/runtime: Make `Runtime::run` more readable

A small refactoring that reorders arms of a match and makes them shorter
by precise imports.
This commit is contained in:
Lorenz Leutgeb 2026-02-17 19:35:17 +01:00 committed by Fintan Halpenny
parent 057edf55b8
commit 30701cc6fb
1 changed files with 7 additions and 6 deletions

View File

@ -418,13 +418,14 @@ impl<H: ReactionHandler> Runtime<H> {
if self.handle_events(tick, events) {
// If a wake event was emitted, eagerly consume all control messages.
loop {
use ControlMessage::*;
use TryRecvError::*;
match self.receiver.try_recv() {
Err(TryRecvError::Empty) => break,
Err(TryRecvError::Disconnected) => {
panic!("control channel disconnected unexpectedly")
}
Ok(ControlMessage::Shutdown) => return self.handle_shutdown(),
Ok(ControlMessage::Command(cmd)) => self.service.handle_command(*cmd),
Ok(Command(cmd)) => self.service.handle_command(*cmd),
Ok(Shutdown) => return self.handle_shutdown(),
Err(Empty) => break,
Err(Disconnected) => panic!("control channel disconnected unexpectedly"),
}
}
}