Update mod.rs (#4240)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
pull/4255/head
dullbananas 5 months ago committed by GitHub
parent 8d52c7e7c7
commit 3e2393993e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,11 +36,11 @@ impl RateLimitCell {
let state_weak_ref = Arc::downgrade(&state);
tokio::spawn(async move {
let hour = Duration::from_secs(3600);
let interval = Duration::from_secs(120);
// This loop stops when all other references to `state` are dropped
while let Some(state) = state_weak_ref.upgrade() {
tokio::time::sleep(hour).await;
tokio::time::sleep(interval).await;
state
.lock()
.expect("Failed to lock rate limit mutex for reading")

Loading…
Cancel
Save