mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
Avoid unnecessary cache writes in /status
Introduce check to avoid unneccesarry cache writes.
This commit is contained in:
parent
337e2288e8
commit
27fe2969d7
1 changed files with 8 additions and 3 deletions
11
bird/bird.go
11
bird/bird.go
|
@ -132,10 +132,15 @@ func RunAndParse(cmd string, parser func(io.Reader) Parsed) (Parsed, bool) {
|
|||
}
|
||||
|
||||
func Status() (Parsed, bool) {
|
||||
birdStatus, ok := RunAndParse("status", parseStatus)
|
||||
birdStatus, from_cache := RunAndParse("status", parseStatus)
|
||||
if isSpecial(birdStatus) {
|
||||
return birdStatus, ok
|
||||
return birdStatus, from_cache
|
||||
}
|
||||
|
||||
if from_cache {
|
||||
return birdStatus, from_cache
|
||||
}
|
||||
|
||||
status := birdStatus["status"].(Parsed)
|
||||
|
||||
// Last Reconfig Timestamp source:
|
||||
|
@ -164,7 +169,7 @@ func Status() (Parsed, bool) {
|
|||
|
||||
birdStatus["status"] = status
|
||||
|
||||
return birdStatus, ok
|
||||
return birdStatus, from_cache
|
||||
}
|
||||
|
||||
func Protocols() (Parsed, bool) {
|
||||
|
|
Loading…
Add table
Reference in a new issue