diff --git a/ntex-service/CHANGES.md b/ntex-service/CHANGES.md index 6e17abf4..7087f392 100644 --- a/ntex-service/CHANGES.md +++ b/ntex-service/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## [3.3.2] - 2024-11-10 + +* Fix un-needed wakeups for unready future + ## [3.3.1] - 2024-11-04 * Optimize readiness handling diff --git a/ntex-service/Cargo.toml b/ntex-service/Cargo.toml index de2c8e0a..3713a98a 100644 --- a/ntex-service/Cargo.toml +++ b/ntex-service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ntex-service" -version = "3.3.1" +version = "3.3.2" authors = ["ntex contributors "] description = "ntex service" keywords = ["network", "framework", "async", "futures"] diff --git a/ntex-service/src/ctx.rs b/ntex-service/src/ctx.rs index c404eee2..8dedbbe5 100644 --- a/ntex-service/src/ctx.rs +++ b/ntex-service/src/ctx.rs @@ -19,10 +19,6 @@ pub(crate) struct WaitersRef { impl WaitersRef { pub(crate) fn new() -> (u32, Self) { let mut waiters = slab::Slab::new(); - - // first insert for wake ups from services - let _ = waiters.insert(None); - ( waiters.insert(Default::default()) as u32, WaitersRef { @@ -66,11 +62,6 @@ impl WaitersRef { self.get()[idx as usize] = Some(cx.waker().clone()); } - pub(crate) fn register_unready(&self, cx: &mut Context<'_>) { - self.get()[0] = Some(cx.waker().clone()); - self.get_wakers().push(0); - } - pub(crate) fn notify(&self) { let wakers = self.get_wakers(); if !wakers.is_empty() { diff --git a/ntex-service/src/pipeline.rs b/ntex-service/src/pipeline.rs index 6e815128..791f67b2 100644 --- a/ntex-service/src/pipeline.rs +++ b/ntex-service/src/pipeline.rs @@ -464,10 +464,7 @@ where } let fut = slf.fut.as_mut().unwrap(); match unsafe { Pin::new_unchecked(fut) }.poll(cx) { - Poll::Pending => { - slf.pl.state.waiters.register_unready(cx); - Poll::Pending - } + Poll::Pending => Poll::Pending, Poll::Ready(res) => { let _ = slf.fut.take(); slf.pl.state.waiters.notify();