improve filtering the noise
- filter larger downtimes - for small downtimes sort by counts
This commit is contained in:
parent
05bff7f5ad
commit
d9b8a90701
10
main.go
10
main.go
|
@ -47,7 +47,7 @@ func (r route) Downtime(now time.Time) float64 {
|
|||
}
|
||||
|
||||
func (r route) Noise(now time.Time) bool {
|
||||
return r.Counter <= uint(now.Sub(startTime).Hours()) && r.Downtime(now) < 0.1
|
||||
return r.Counter <= uint(now.Sub(startTime).Hours())+10 && r.Downtime(now) < 0.5
|
||||
}
|
||||
|
||||
func (r route) String() string {
|
||||
|
@ -133,7 +133,13 @@ func (rs *routeStats) getLongest() []route {
|
|||
|
||||
t := time.Now()
|
||||
sort.Slice(ret, func(i, j int) bool {
|
||||
return ret[i].DurationUntil(t) > ret[j].DurationUntil(t)
|
||||
id := ret[i].Downtime(t)
|
||||
jd := ret[j].Downtime(t)
|
||||
if id == jd ||
|
||||
(id < 0.5 && jd < 0.5) {
|
||||
return ret[i].Counter > ret[j].Counter
|
||||
}
|
||||
return id > jd
|
||||
})
|
||||
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue