mirror of https://github.com/statping/statping
Fix wrong Downtime Calculation
The downtime was calculated wrong because the time when the latest failure oocured was subtraced of the time when the latest failure occured. And this will be zero. Now it subtractes from the Date of the latest failure the Date of the latest successfull hit. Signed-off-by: Emanuel Bennici <benniciemanuel78@gmail.com>pull/308/head
parent
b75ae61de2
commit
c1f4ee865a
|
@ -260,7 +260,7 @@ func (s *Service) Downtime() time.Duration {
|
|||
if len(hits) == 0 {
|
||||
return time.Now().UTC().Sub(fail.CreatedAt.UTC())
|
||||
}
|
||||
since := fail.CreatedAt.UTC().Sub(fail.CreatedAt.UTC())
|
||||
since := fail.CreatedAt.UTC().Sub(hits[0].CreatedAt.UTC())
|
||||
return since
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue