forked from Team-Ortix/StatusApp
20 lines
364 B
Go
20 lines
364 B
Go
|
package server
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"status/db"
|
||
|
)
|
||
|
|
||
|
func getStatus() map[string]db.PingEntry {
|
||
|
entries := db.GetFromDB("", time.Now().Add(time.Duration(-2)*time.Minute), time.Now())
|
||
|
result := make(map[string]db.PingEntry)
|
||
|
for _, v := range entries {
|
||
|
if v.Time.Before(result[v.ServiceName].Time) {
|
||
|
continue
|
||
|
}
|
||
|
result[v.ServiceName] = v
|
||
|
}
|
||
|
return result
|
||
|
}
|