Skip to content

Commit

Permalink
Log job retries as warnings instead of errors (#743)
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller authored Feb 8, 2025
1 parent 0b3f8fe commit b2737cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Errors returned from retryable jobs are now logged with warning logs instead of error logs. Error logs are still used for jobs that error after reaching `max_attempts`. [PR #743](https://github.com/riverqueue/river/pull/743).

### Fixed

- `riverdatabasesql` driver: properly handle `nil` values in `bytea[]` inputs. This fixes the driver's handling of empty unique keys on insert for non-unique jobs with the newer unique jobs implementation. [PR #739](https://github.com/riverqueue/river/pull/739).
Expand Down
2 changes: 1 addition & 1 deletion example_graceful_shutdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,5 @@ func Example_gracefulShutdown() {
// Received SIGINT/SIGTERM; initiating soft stop (try to wait for jobs to finish)
// Received SIGINT/SIGTERM again; initiating hard stop (cancel everything)
// Job cancelled
// jobExecutor: Job errored
// jobExecutor: Job errored; retrying
}
6 changes: 5 additions & 1 deletion job_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ func (e *jobExecutor) reportError(ctx context.Context, res *jobExecutorResult) {
cancelJob = true
e.Logger.DebugContext(ctx, e.Name+": Job cancelled explicitly", logAttrs...)
case res.Err != nil:
e.Logger.ErrorContext(ctx, e.Name+": Job errored", logAttrs...)
if e.JobRow.Attempt >= e.JobRow.MaxAttempts {
e.Logger.ErrorContext(ctx, e.Name+": Job errored", logAttrs...)
} else {
e.Logger.WarnContext(ctx, e.Name+": Job errored; retrying", logAttrs...)
}
case res.PanicVal != nil:
e.Logger.ErrorContext(ctx, e.Name+": Job panicked", logAttrs...)
}
Expand Down

0 comments on commit b2737cf

Please sign in to comment.