Skip to content

Commit

Permalink
Merge pull request #3 from pconstantinou/bug/set-context
Browse files Browse the repository at this point in the history
Set job in context before calling updates
  • Loading branch information
pconstantinou authored Mar 25, 2024
2 parents 4a13c41 + 951f8ca commit f84f7cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backends/postgres/postgres_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,9 @@ func (p *PgBackend) handleJob(ctx context.Context, jobID string) (err error) {
return
}

ctx = withJobContext(ctx, job)
ctx = context.WithValue(ctx, txCtxVarKey, tx)

if job.RunAfter.After(time.Now()) {
p.logger.Error("Running a job too early.",
slog.String("queue", job.Queue),
Expand All @@ -940,9 +943,6 @@ func (p *PgBackend) handleJob(ctx context.Context, jobID string) (err error) {
return
}

ctx = withJobContext(ctx, job)
ctx = context.WithValue(ctx, txCtxVarKey, tx)

// check if the job is being retried and increment retry count accordingly
if job.Status != internal.JobStatusNew {
job.Retries++
Expand Down

0 comments on commit f84f7cb

Please sign in to comment.