Small mutex fix

This commit is contained in:
Dominic Ferrando
2025-04-23 21:27:03 -04:00
parent 807ac94cc6
commit a4c3e2fbda
+9 -7
View File
@@ -593,20 +593,22 @@ func main() {
// ----------------- // -----------------
go func() { go func() {
for range time.Tick(10 * time.Minute) { ticker := time.NewTicker(10 * time.Second)
defer ticker.Stop()
for range ticker.C {
util.CooldownMutex.Lock() util.CooldownMutex.Lock()
defer util.CooldownMutex.Unlock() for ip, t := range util.PostCooldowns {
for ip, cooldown := range util.PostCooldowns { if time.Since(t) >= util.POST_COOLDOWN {
if time.Since(cooldown) >= util.POST_COOLDOWN {
delete(util.PostCooldowns, ip) delete(util.PostCooldowns, ip)
} }
} }
for ip, t := range util.ThreadCooldowns {
for ip, cooldown := range util.ThreadCooldowns { if time.Since(t) >= util.THREAD_COOLDOWN {
if time.Since(cooldown) >= util.THREAD_COOLDOWN {
delete(util.ThreadCooldowns, ip) delete(util.ThreadCooldowns, ip)
} }
} }
util.CooldownMutex.Unlock()
} }
}() }()