Small mutex fix
This commit is contained in:
+9
-7
@@ -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()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user