Skip to content

Commit

Permalink
Fix issue with counting up jobs that didn't finish
Browse files Browse the repository at this point in the history
We saw an issue with a negative amount for a new customer
that only showed in the repo-level breakout.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed May 18, 2023
1 parent 873a22b commit 3541869
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,18 @@ func main() {
summary := repoSummary[owner+"/"+repo.GetName()]

for _, job := range jobs.Jobs {
dur := job.GetCompletedAt().Time.Sub(job.GetStartedAt().Time)
if dur > longestBuild {
longestBuild = dur
}
if dur > summary.LongestBuild {
summary.LongestBuild = dur
if !job.GetCompletedAt().IsZero() {
dur := job.GetCompletedAt().Time.Sub(job.GetStartedAt().Time)
if dur > longestBuild {
longestBuild = dur
}
if dur > summary.LongestBuild {
summary.LongestBuild = dur
}

summary.TotalTime += dur
}

summary.TotalTime += dur

if _, ok := conclusion[job.GetConclusion()]; !ok {
conclusion[job.GetConclusion()] = 0
}
Expand Down

0 comments on commit 3541869

Please sign in to comment.