Skip to content

Add environment variable to turn off recurring jobs #558

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

Open
daniel-nerdgeschoss opened this issue May 7, 2025 · 2 comments
Open

Add environment variable to turn off recurring jobs #558

daniel-nerdgeschoss opened this issue May 7, 2025 · 2 comments

Comments

@daniel-nerdgeschoss
Copy link

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!

@rosa
Copy link
Member

rosa commented May 9, 2025

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?

@daniel-nerdgeschoss
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants