Skip to content

fix: guard against missing handler in worker executeJob#18

Merged
robertLichtnow merged 1 commit into
mainfrom
robertLichtnow/worker-handler-check
Mar 9, 2026
Merged

fix: guard against missing handler in worker executeJob#18
robertLichtnow merged 1 commit into
mainfrom
robertLichtnow/worker-handler-check

Conversation

@robertLichtnow

Copy link
Copy Markdown
Owner

Summary

Added a handler existence check in Worker.executeJob() to prevent crashes when a job is acquired for an unregistered pattern. If no handler is found, the job is failed, a failure event is emitted with a descriptive error including the job ID, and the worker continues processing.

Previously, calling handler!(job) with the non-null assertion would crash if the handler was undefined. Now the worker gracefully handles this edge case by failing the job in the database and continuing to pull new jobs without interruption.

Fail the job and emit a failure event instead of crashing when no
handler is registered for an acquired job's pattern.
@robertLichtnow robertLichtnow merged commit b963cbc into main Mar 9, 2026
9 checks passed
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.

1 participant