Update mod.rs (#4240)

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
dullbananas 2023-12-12 11:06:17 -07:00 committed by GitHub
parent 8d52c7e7c7
commit 3e2393993e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")