mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
Update mod.rs (#4240)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
8d52c7e7c7
commit
3e2393993e
@ -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…
Reference in New Issue
Block a user