mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-23 03:44:04 +03:00
kernel: increase event loop queue size & error if full
This commit is contained in:
parent
9bd5456fb0
commit
f551c13d32
@ -31,7 +31,7 @@ mod terminal;
|
||||
mod timer;
|
||||
mod vfs;
|
||||
|
||||
const EVENT_LOOP_CHANNEL_CAPACITY: usize = 10_000;
|
||||
const EVENT_LOOP_CHANNEL_CAPACITY: usize = 100_000;
|
||||
const EVENT_LOOP_DEBUG_CHANNEL_CAPACITY: usize = 50;
|
||||
const TERMINAL_CHANNEL_CAPACITY: usize = 32;
|
||||
const WEBSOCKET_SENDER_CHANNEL_CAPACITY: usize = 32;
|
||||
|
@ -1190,7 +1190,20 @@ impl KernelMessage {
|
||||
}
|
||||
|
||||
pub async fn send(self, sender: &MessageSender) {
|
||||
sender.send(self).await.expect("kernel message sender died");
|
||||
let Err(e) = sender.try_send(self) else {
|
||||
// not Err -> send successful; done here
|
||||
return;
|
||||
};
|
||||
// its an Err: handle
|
||||
match e {
|
||||
tokio::sync::mpsc::error::TrySendError::Closed(_) => {
|
||||
panic!("kernel message sender: receiver closed");
|
||||
}
|
||||
tokio::sync::mpsc::error::TrySendError::Full(_) => {
|
||||
// TODO: implement backpressure
|
||||
panic!("kernel overloaded with messages: TODO: implement backpressure");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user