mirror of https://github.com/statping/statping
updated logic
parent
b64811a991
commit
a8e8d2da06
|
@ -547,14 +547,11 @@ func apiAllServicesStatusHandler(w http.ResponseWriter, r *http.Request) {
|
|||
var srvs []services.ServiceWithDowntime
|
||||
m := make(map[int64]downtimes.Downtime)
|
||||
if t == "" {
|
||||
timeNow := time.Now()
|
||||
dtime := downtimes.FindDowntime2()
|
||||
for i := 0; i < len(dtime); i++ {
|
||||
downtimeVar := dtime[i]
|
||||
serviceVar, _ := services.Find(downtimeVar.ServiceId)
|
||||
checkInterval := time.Duration(serviceVar.Interval)
|
||||
timeInstance := timeNow.Add(-time.Second * checkInterval)
|
||||
if downtimeVar.End == nil || timeInstance.Before(*(downtimeVar.End)) || timeInstance.Equal(*(downtimeVar.End)) {
|
||||
if serviceVar.Online == false {
|
||||
m[downtimeVar.ServiceId] = downtimeVar
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +562,6 @@ func apiAllServicesStatusHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
for _, v := range services.AllInOrder() {
|
||||
var serviceDowntimeVar services.ServiceWithDowntime
|
||||
serviceDowntimeVar.Service = v
|
||||
|
|
Loading…
Reference in New Issue