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

Add Delayed::Plugins::Pidfile #1202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jdufresne
Copy link

The new plugin creates a pidfile at location
#{Rails.root}/tmp/delayed_job.pid when a worker starts and then removes it when a worker stops. It uses lifecycle.around(:execute) to achieve this.

The file is created in "write exclusive" mode. This means if the file already exists, Errno::EEXIST is raised. This ensures that a worker doesn't overwrite a pidfile in use.

This plugin is useful to allow an outside observer (e.g. a healthcheck) to check if the worker started successfully.

The plugin is not installed by default for backwards compatibility. Users can use it by adding to their initializer:

Delayed::Worker.plugins << Delayed::Plugin::Pidfile

refs #875

The new plugin creates a pidfile at location
`#{Rails.root}/tmp/delayed_job.pid` when a worker starts and then
removes it when a worker stops. It uses `lifecycle.around(:execute)` to
achieve this.

The file is created in "write exclusive" mode. This means if the file
already exists, `Errno::EEXIST` is raised. This ensures that a worker
doesn't overwrite a pidfile in use.

This plugin is useful to allow an outside observer (e.g. a healthcheck)
to check if the worker started successfully.

The plugin is not installed by default for backwards compatibility.
Users can use it by adding to their initializer:

Delayed::Worker.plugins << Delayed::Plugin::Pidfile

refs collectiveidea#875
@jdufresne jdufresne mentioned this pull request Feb 3, 2024
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.

None yet

1 participant