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
Emanuel Bennici 2019-11-28 23:34:12 +01:00
parent b75ae61de2
commit c1f4ee865a
No known key found for this signature in database
GPG Key ID: 17FA2D56BAD01661
1 changed files with 1 additions and 1 deletions

View File

@ -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
}