From 209ec4c82f0fa69655e725cac6569ea61782048f Mon Sep 17 00:00:00 2001 From: Max Niederman Date: Mon, 22 Apr 2024 19:36:41 -0700 Subject: [PATCH] feat(worker): reduce event poll timeout --- packages/centipede_worker/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/centipede_worker/src/lib.rs b/packages/centipede_worker/src/lib.rs index 5dc1247..86d4865 100644 --- a/packages/centipede_worker/src/lib.rs +++ b/packages/centipede_worker/src/lib.rs @@ -79,7 +79,7 @@ impl<'r> Worker<'r> { Ok(()) } - /// Wait for at least one event and handle it. + /// Wait for an event and handle it, or time out after 100ms. /// /// Mutably borrows an event buffer for scratch space, to avoid reallocating it. pub fn wait_and_handle(&mut self, events: &mut mio::Events) -> Result<(), Error> { @@ -89,7 +89,7 @@ impl<'r> Worker<'r> { events.clear(); self.poll - .poll(events, Some(Duration::from_secs(1))) + .poll(events, Some(Duration::from_millis(100))) .map_err(Error::Poll)?; for event in &*events {