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

Commits on Feb 3, 2024

  1. Add Delayed::Plugins::Pidfile

    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 committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    b4ab39f View commit details
    Browse the repository at this point in the history