From 2b7eea26796823ad32ff83f6b016dfecda5f104b Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Mon, 25 Sep 2023 20:45:27 +0400 Subject: [PATCH] Use waker API instead of recursing --- crates/teloxide/src/update_listeners/polling.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/teloxide/src/update_listeners/polling.rs b/crates/teloxide/src/update_listeners/polling.rs index 644098b8..b713db37 100644 --- a/crates/teloxide/src/update_listeners/polling.rs +++ b/crates/teloxide/src/update_listeners/polling.rs @@ -406,8 +406,10 @@ impl Stream for PollingStream<'_, B> { .send(); this.in_flight.set(Some(req)); - // Recurse to poll `self.in_flight` - self.poll_next(cx) + // Immediately wake up to poll `self.in_flight` + // (without this this stream becomes a zombie) + cx.waker().wake_by_ref(); + Poll::Pending } }