jobqueue: improve logging

Add job ID where it's missing
This commit is contained in:
Diaa Sami 2021-11-10 12:23:56 +01:00 committed by Ondřej Budai
parent 9c6438c8f4
commit df73b835c3
2 changed files with 2 additions and 2 deletions

View file

@ -87,7 +87,7 @@ func WatchJob(ctx context.Context, job worker.Job) {
// Requests and runs 1 job of specified type(s)
// Returning an error here will result in the worker backing off for a while and retrying
func RequestAndRunJob(client *worker.Client, acceptedJobTypes []string, jobImpls map[string]JobImplementation) error {
logrus.Info("Waiting for a new job...")
logrus.Debug("Waiting for a new job...")
job, err := client.RequestJob(acceptedJobTypes, common.CurrentArch())
if err == worker.ErrClientRequestJobTimeout {
logrus.Debugf("Requesting job timed out: %v", err)

View file

@ -274,7 +274,7 @@ func (q *dbJobQueue) FinishJob(id uuid.UUID, result interface{}) error {
defer func() {
err = tx.Rollback(context.Background())
if err != nil && !errors.As(err, &pgx.ErrTxClosed) {
logrus.Error("error rolling back finish job transaction: ", err)
logrus.Errorf("error rolling back finish job transaction for job %s: %v", id, err)
}
}()