Skip to content

fix: record error message and backtrace when job expires#447

Open
SAY-5 wants to merge 1 commit into
que-rb:masterfrom
SAY-5:fix/save-error-on-expire
Open

fix: record error message and backtrace when job expires#447
SAY-5 wants to merge 1 commit into
que-rb:masterfrom
SAY-5:fix/save-error-on-expire

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 21, 2026

Closes #438.

Que.execute :expire_job previously took only the job id, so when error_count > maximum_retry_count the row was marked expired_at but last_error_message and last_error_backtrace stayed nil. The retry path already records both via :set_error, so jobs that exhaust retries lost the diagnostic info from their final failure.

The :expire_job SQL now also takes the error message and backtrace and writes them with COALESCE, so callers of the public Que::JobMethods#expire that have no que_error (manual expiration) still preserve any previously recorded error. Worker#work_job and JobMethods#expire both pass the error through when one is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors are not stored into last_error_backtrace/last_error_message if job maximum_retry_count == 0

1 participant