mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-10 06:54:12 +00:00
Update mod.rs (#4240)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
8d52c7e7c7
commit
3e2393993e
1 changed files with 2 additions and 2 deletions
|
@ -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 a new issue