mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
make checking the other way around
This commit is contained in:
parent
26b8c8981b
commit
a2850e5fdc
1 changed files with 3 additions and 3 deletions
|
@ -45,7 +45,7 @@ func InstallRateLimitReset() {
|
|||
|
||||
for _ = range c {
|
||||
RateLimitConf.Lock()
|
||||
RateLimitConf.Conf.Reqs = 0
|
||||
RateLimitConf.Conf.Reqs = RateLimitConf.Conf.Max
|
||||
RateLimitConf.Unlock()
|
||||
}
|
||||
}()
|
||||
|
@ -60,14 +60,14 @@ func checkRateLimit() bool {
|
|||
}
|
||||
|
||||
RateLimitConf.RLock()
|
||||
check = RateLimitConf.Conf.Reqs > RateLimitConf.Conf.Max
|
||||
check = RateLimitConf.Conf.Reqs < 1
|
||||
RateLimitConf.RUnlock()
|
||||
if check {
|
||||
return false
|
||||
}
|
||||
|
||||
RateLimitConf.Lock()
|
||||
RateLimitConf.Conf.Reqs += 1
|
||||
RateLimitConf.Conf.Reqs -= 1
|
||||
RateLimitConf.Unlock()
|
||||
|
||||
return true
|
||||
|
|
Loading…
Add table
Reference in a new issue