fix panic when there were no recent errors
This commit is contained in:
parent
5d844fc3ea
commit
146adcf7fd
2 changed files with 8 additions and 5 deletions
|
@ -102,8 +102,10 @@ func (s *stats) log() {
|
||||||
delete(s.errors, name)
|
delete(s.errors, name)
|
||||||
}
|
}
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
s.logger.Printf(
|
|
||||||
"Stats: %d blobs, %d streams, errors: %s",
|
if len(errStr) > 2 {
|
||||||
blobs, streams, errStr[:len(errStr)-2], // trim last comma and space
|
errStr = errStr[:len(errStr)-2] // trim last comma and space
|
||||||
)
|
}
|
||||||
|
|
||||||
|
s.logger.Printf("Stats: %d blobs, %d streams, errors: %s", blobs, streams, errStr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,9 @@ import (
|
||||||
// TODO: this needs to be shut down cleanly
|
// TODO: this needs to be shut down cleanly
|
||||||
|
|
||||||
func Run(url, updateCmd string) {
|
func Run(url, updateCmd string) {
|
||||||
|
t := time.NewTicker(1 * time.Minute)
|
||||||
for {
|
for {
|
||||||
<-time.After(1 * time.Minute)
|
<-t.C
|
||||||
|
|
||||||
r, err := http.Head(url)
|
r, err := http.Head(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue