Skip to content

Commit 36ecc02

Browse files
committed
remove futures-util dependency
1 parent 06f5d59 commit 36ecc02

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ version = "0.1.0"
66

77
[dependencies]
88
dashmap = "6"
9-
futures-util = { version = "0.3", default-features = false }
109
http = "1"
1110
http-body-util = "0.1"
1211
hyper = { version = "1", default-features = false }

src/expiring_lru.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use dashmap::{DashMap, mapref::one::Ref};
2-
use futures_util::StreamExt;
3-
use std::{borrow::Borrow, hash::Hash, marker::PhantomData, ops::Deref, sync::Arc, time::Duration};
2+
use std::{
3+
borrow::Borrow, future::poll_fn, hash::Hash, marker::PhantomData, ops::Deref, sync::Arc,
4+
time::Duration,
5+
};
46
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender, unbounded_channel};
57
use tokio_util::time::{DelayQueue, delay_queue::Key};
68
use tracing::debug;
@@ -53,7 +55,7 @@ async fn decay_task<K, V>(
5355

5456
loop {
5557
tokio::select! {
56-
Some(key) = queue.next(), if !queue.is_empty() => {
58+
Some(key) = poll_fn(|cx| queue.poll_expired(cx)), if !queue.is_empty() => {
5759
// An item expired in the queue, remove it from the map
5860
debug!("Removing expired entry from ratelimiter decay queue");
5961
map.remove(key.get_ref());

0 commit comments

Comments
 (0)