Skip to content

Commit 343dd0f

Browse files
author
0x_antoni
committed
fix ci bug
1 parent 71c2976 commit 343dd0f

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

crates/util/io/src/mio_util/event_loop.rs

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,25 @@ impl<H: Handler> EventLoop<H> {
287287
for evt in events {
288288
match evt.token() {
289289
NOTIFY_OR_TIMER => {
290-
// channel and timer use the same token, so we need to
291-
// check both the channel and the timer
292-
self.notify(handler);
293-
self.timer_process(handler);
290+
while self.notify_queue.len() > 0 {
291+
match self.notify_queue.pop() {
292+
Some(id) if id == self.channel_noti_id => {
293+
self.notify(handler);
294+
}
295+
Some(id) if id == self.timer_noti_id => {
296+
self.timer_process(handler);
297+
}
298+
Some(id) => {
299+
trace!("event loop got spurious wakeup for unknown id: {:?}", id);
300+
}
301+
None => {
302+
// Spurious wakeup, nothing to do
303+
trace!(
304+
"event loop got spurious wakeup with no id"
305+
);
306+
}
307+
}
308+
}
294309
}
295310
_ => self.io_event(handler, evt),
296311
}
@@ -302,21 +317,17 @@ impl<H: Handler> EventLoop<H> {
302317
}
303318

304319
fn notify(&mut self, handler: &mut H) {
305-
for _ in 0..self.config.messages_per_tick {
306-
match self.notify_rx.try_recv() {
307-
Ok(msg) => {
308-
handler.notify(self, msg);
309-
let _ = self.notify_queue.pop();
310-
}
311-
_ => break,
320+
match self.notify_rx.try_recv() {
321+
Ok(msg) => {
322+
handler.notify(self, msg);
312323
}
324+
_ => {}
313325
}
314326
}
315327

316328
fn timer_process(&mut self, handler: &mut H) {
317329
while let Some(t) = self.timer.poll() {
318330
handler.timeout(self, t);
319-
let _ = self.notify_queue.pop();
320331
}
321332
}
322333
}

crates/util/io/src/service_mio.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,8 @@ where Message: Send + Sync + 'static
713713

714714
{
715715
let mut poll = network_poll.lock();
716-
poll.poll(
717-
&mut events,
718-
Some(Duration::from_millis(100)),
719-
)
720-
.expect("Network poll failure");
716+
poll.poll(&mut events, Some(Duration::from_secs(1)))
717+
.expect("Network poll failure");
721718
}
722719

723720
for event in &events {

0 commit comments

Comments
 (0)