Browse Source

En cours de développement

master
losyme 5 months ago
parent
commit
bd375627a5
  1. 14
      workers/worker.go

14
workers/worker.go

@ -9,7 +9,6 @@ package workers
import (
"context"
"fmt"
"runtime/debug"
"time"
"forge.chapril.org/dune/jw"
@ -56,28 +55,21 @@ func (w *worker) updateJob(job *jw.Job) {
if job.Status == jw.StatusPending {
logger.Info( //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
"END",
"job", job.ID,
"status", job.Status,
"run_after", job.RunAfter.String(),
"attempt", fmt.Sprintf("%d/%d", job.Attempt, job.MaxAttempts),
)
} else {
logger.Info("END", "status", job.Status) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
logger.Info("END", "job", job.ID, "status", job.Status) //::::::::::::::::::::::::::::::::::::::::::::::
}
} else {
logger.Info("END", "model", err) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
logger.Error("END", "job", job.ID, nil, err) //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
}
}
}
func (w *worker) maybeRunJob() time.Duration {
defer func() {
if data := recover(); data != nil {
if w.logger != nil {
w.logger.Error("PANIC ERROR RECOVERED", "data", data, "stack", string(debug.Stack())) //::::::::::::::::
}
}
}()
job, err := w.model.NextJob(w.runner.Namespace())
if err != nil {
return _timeoutOnError

Loading…
Cancel
Save