Display YP errors
This commit is contained in:
parent
4de2841659
commit
6f6971f482
8
yp/yp.go
8
yp/yp.go
@ -18,6 +18,7 @@ import (
|
|||||||
const pingInterval = 4 * time.Minute
|
const pingInterval = 4 * time.Minute
|
||||||
|
|
||||||
var getStatus func() models.Status
|
var getStatus func() models.Status
|
||||||
|
var _inErrorState = false
|
||||||
|
|
||||||
//YP is a service for handling listing in the Owncast directory.
|
//YP is a service for handling listing in the Owncast directory.
|
||||||
type YP struct {
|
type YP struct {
|
||||||
@ -97,10 +98,15 @@ func (yp *YP) ping() {
|
|||||||
json.Unmarshal(body, &pingResponse)
|
json.Unmarshal(body, &pingResponse)
|
||||||
|
|
||||||
if !pingResponse.Success {
|
if !pingResponse.Success {
|
||||||
log.Debugln("YP Ping error returned from service:", pingResponse.Error)
|
if !_inErrorState {
|
||||||
|
log.Warnln("YP Ping error returned from service:", pingResponse.Error)
|
||||||
|
}
|
||||||
|
_inErrorState = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_inErrorState = false
|
||||||
|
|
||||||
if pingResponse.Key != key {
|
if pingResponse.Key != key {
|
||||||
yp.writeSavedKey(pingResponse.Key)
|
yp.writeSavedKey(pingResponse.Key)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user