Skip to content

Add environment variable to turn off recurring jobs #558

Closed

Description

@daniel-nerdgeschoss

Hello, thank you for Solid Queue!

We're in the process of migrating an older app form Sidekiq to Solid Queue. We're using Heroku Review apps, and we don't want any recurring jobs to run there. It would be nice if we could completely skip recurring tasks by setting an environment variable.

In searching for a workaround, I found that I could make it work if I added this line to bin/jobs:

  require_relative "../config/environment"
  require "solid_queue/cli"

+ ARGV << "--skip-recurring" if ENV["SOLID_QUEUE_SKIP_RECURRING"]

  SolidQueue::Cli.start(ARGV)

(This is of course not the right way to add this, but as a workaround, it's okay.)

Is an option like this something you'd be interested in? I could try to implement it properly, similar to how the SOLID_QUEUE_RECURRING_SCHEDULE environment variable works, and send a PR.

Thank you again!

Activity

  1. rosa commented on May 9, 2025

    @rosa
    Member

    Hey @daniel-nerdgeschoss, sure thing! Feel free to open a pull request for this.

    I wonder, however, whether it'd be sufficient for you to call bin/jobs like this:

    bin/jobs --skip-recurring
    

    Or do you really need the environment variable rather than the command-line option?

  2. daniel-nerdgeschoss commented on May 12, 2025

    @daniel-nerdgeschoss
    Author

    Hey @rosa, thanks for the positive reply! I will take a look when I find the time.

    Sadly, adding the flag is not quite sufficient because in Heroku, you can only set one Procfile for all environments, which looks like this:

    web: bin/rails serve
    worker: bin/jobs
    release: bin/rails db:migrate
    

    This file is used for Production, Staging, and Review Apps – so the flag would either always be set, or never. The best way to be environment specific in Heroku is … to use environment variables. :D

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions