1
0
Fork 0
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:
Patrick Seeburger 2018-09-19 11:21:02 +02:00 committed by Benedikt Rudolph
parent 337e2288e8
commit 27fe2969d7

View file

@ -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) {