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

Starting delayed job in production environment not working #14

Closed
ChunAllen opened this issue Jan 10, 2018 · 5 comments
Closed

Starting delayed job in production environment not working #14

ChunAllen opened this issue Jan 10, 2018 · 5 comments

Comments

@ChunAllen
Copy link

I'm using capistrano3 and this gem for delayed job in production. When I deployed to production environment using cap production deploy here's the screenshot of the capistrano log

screenshot 2018-01-10 16 57 01

it should restart the delayed job worker but it's not running. The workaround I did was to run

RAILS_ENV=production bin/delayed_job restart

in the root directory of my current application.

Any solutions with this?

@rab
Copy link

rab commented Jan 11, 2018

That certainly looks like there are 2 workers (with PIDs 7871 and 7887) running after the restart.

Why do you say that the worker is not running?

@ChunAllen
Copy link
Author

@rab I checked the jobs in delayed job web it's still in pending/enqueued and not running, but if I do the RAILS_ENV=production bin/delayed_job start
then it will run

@ChunAllen
Copy link
Author

ChunAllen commented Jan 31, 2018

Every time I deploy using capistrano I can see that there's a delayed_job:restart task which basically runs the bundle exec bin/delayed_job -n 5 --queues=mailer,tracking --prefix=reports restart

screenshot 2018-01-31 12 10 52

But is it running the workers with environment? I think it's not running workers in a specific environment because my jobs are just pending

@rab
Copy link

rab commented Jan 31, 2018

If you look at bin/delayed_job, you'll see that it loads (requires actually) your config/environment file.

When your jobs are pending, can you open a console and run: pp Delayed::Job.all to see what queue each job is placed in? (If you have lots of jobs, it should be enough to do Delayed::Job.group(:queue).count and see job counts by queue.

Are the jobs being queued to the mailer or tracking queues that your command is telling them to look for? (Note that the default is to get the next job without regard to the queue.)

You can also "manually" run the jobs with rails delayed_job:workoff to see some of the job details as they are processed.

@rab
Copy link

rab commented Jan 22, 2020

Lacking any further response, I'm assuming that your problem was solved or wasn't actually a problem.

@rab rab closed this as completed Jan 22, 2020
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