mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
bugfix: make ratelimiting robust in nested calls
This commit is contained in:
parent
50551ec071
commit
9aeae59874
2 changed files with 8 additions and 2 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.7.1
|
||||
1.7.2
|
||||
|
|
|
@ -69,7 +69,7 @@ func checkRateLimit() bool {
|
|||
}
|
||||
|
||||
RateLimitConf.RLock()
|
||||
check = RateLimitConf.Conf.Reqs < 1
|
||||
check = RateLimitConf.Conf.Reqs > 1
|
||||
RateLimitConf.RUnlock()
|
||||
if check {
|
||||
return false
|
||||
|
@ -105,6 +105,9 @@ func RunAndParse(cmd string, parser func([]byte) Parsed) (Parsed, bool) {
|
|||
|
||||
func Status() (Parsed, bool) {
|
||||
birdStatus, ok := RunAndParse("status", parseStatus)
|
||||
if birdStatus == nil {
|
||||
return birdStatus, ok
|
||||
}
|
||||
status := birdStatus["status"].(Parsed)
|
||||
|
||||
// Last Reconfig Timestamp source:
|
||||
|
@ -142,6 +145,9 @@ func Protocols() (Parsed, bool) {
|
|||
|
||||
func ProtocolsBgp() (Parsed, bool) {
|
||||
p, from_cache := Protocols()
|
||||
if p == nil {
|
||||
return p, from_cache
|
||||
}
|
||||
protocols := p["protocols"].([]string)
|
||||
|
||||
bgpProto := Parsed{}
|
||||
|
|
Loading…
Add table
Reference in a new issue