Skip to content

Commit

Permalink
Sleep rather than tick
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsnaps committed Apr 30, 2024
1 parent f393527 commit f3a21a4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions limitador/src/storage/redis/counters_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ impl Batcher {
F: FnOnce(HashMap<Counter, Arc<CachedCounterValue>>) -> Fut,
Fut: Future<Output = O>,
{
let mut interval = interval(self.interval);
let mut ready = self.batch_ready(max);
loop {
if ready {
Expand Down Expand Up @@ -198,7 +197,7 @@ impl Batcher {
} else {
ready = select! {
_ = self.notifier.notified() => self.batch_ready(max),
_ = interval.tick() => true,
_ = tokio::time::sleep(self.interval) => true,
}
}
}
Expand Down

0 comments on commit f3a21a4

Please sign in to comment.