1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

feat: log a descriptive message when a job exceeds the config timeout

- change the argument from string to error to differentiate
  a timeout error
- when there is a timeout, display a message more descriptive than
  "context deadline"
- always set the StoppedAt state value instead of only if the
  result was unspecified: it is the last state update.
This commit is contained in:
Earl Warren 2025-08-16 19:27:17 +02:00
parent bd2b7d2b32
commit 25879b92f4
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 115 additions and 17 deletions

View file

@ -170,11 +170,7 @@ func (r *Runner) Run(ctx context.Context, task *runnerv1.Task) error {
reporter := report.NewReporter(ctx, cancel, r.client, task, r.cfg.Runner.ReportInterval)
var runErr error
defer func() {
lastWords := ""
if runErr != nil {
lastWords = runErr.Error()
}
_ = reporter.Close(lastWords)
_ = reporter.Close(runErr)
}()
reporter.RunDaemon()
runErr = r.run(ctx, task, reporter)