mirror of https://github.com/statping/statping
adjusted the condition
parent
c24def9598
commit
b64811a991
|
@ -547,14 +547,14 @@ func apiAllServicesStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
var srvs []services.ServiceWithDowntime
|
var srvs []services.ServiceWithDowntime
|
||||||
m := make(map[int64]downtimes.Downtime)
|
m := make(map[int64]downtimes.Downtime)
|
||||||
if t == "" {
|
if t == "" {
|
||||||
dtime:=downtimes.FindDowntime2()
|
|
||||||
timeNow := time.Now()
|
timeNow := time.Now()
|
||||||
|
dtime:=downtimes.FindDowntime2()
|
||||||
for i := 0; i < len(dtime); i++ {
|
for i := 0; i < len(dtime); i++ {
|
||||||
downtimeVar := dtime[i]
|
downtimeVar := dtime[i]
|
||||||
serviceVar,_ := services.Find(downtimeVar.ServiceId)
|
serviceVar,_ := services.Find(downtimeVar.ServiceId)
|
||||||
checkInterval := time.Duration(serviceVar.Interval)
|
checkInterval := time.Duration(serviceVar.Interval)
|
||||||
timeInstance := timeNow.Add(-time.Second * checkInterval)
|
timeInstance := timeNow.Add(-time.Second * checkInterval)
|
||||||
if(timeInstance.After(*(downtimeVar.Start)) || timeInstance.Equal(*(downtimeVar.Start)) ) && (downtimeVar.End == nil || (timeInstance.Before(*(downtimeVar.End)) || timeInstance.Equal(*(downtimeVar.End))) ){
|
if downtimeVar.End == nil || timeInstance.Before(*(downtimeVar.End)) || timeInstance.Equal(*(downtimeVar.End)) {
|
||||||
m[downtimeVar.ServiceId] = downtimeVar
|
m[downtimeVar.ServiceId] = downtimeVar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue