Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log job retries as warnings instead of errors #743

Merged
merged 3 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading