Skip to content

Commit

Permalink
revert the logic and keep or as it was initially (#10)
Browse files Browse the repository at this point in the history
Co-authored-by: kyrylomiro <[email protected]>
  • Loading branch information
kyrylomiro and kyrylomiro authored Mar 5, 2024
1 parent 3be2514 commit 41e7990
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions pkg/actionsmetrics/event_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func (reader *EventReader) fetchAndParseWorkflowJobLogs(ctx context.Context, e *

var (
queuedTime time.Time
startedTime *time.Time
startedTime time.Time
completedTime time.Time
)

Expand Down Expand Up @@ -274,28 +274,18 @@ func (reader *EventReader) fetchAndParseWorkflowJobLogs(ctx context.Context, e *
}

if strings.HasPrefix(line, "Job is about to start running on the runner:") || strings.HasPrefix(line, "Current runner version:") {
if startedTime == nil {
st, _ := time.Parse(time.RFC3339, timestamp)
startedTime = &st
continue
}
startedTime, _ = time.Parse(time.RFC3339, timestamp)
continue
}

// Last line in the log will count as the completed time
completedTime, _ = time.Parse(time.RFC3339, timestamp)
}
}()
if startedTime == nil {
return &ParseResult{
ExitCode: exitCode,
QueueTime: time.Duration(0),
RunTime: time.Duration(0),
}, nil

}
return &ParseResult{
ExitCode: exitCode,
QueueTime: startedTime.Sub(queuedTime),
RunTime: completedTime.Sub(*startedTime),
RunTime: completedTime.Sub(startedTime),
}, nil
}

0 comments on commit 41e7990

Please sign in to comment.