Hi there,
We use Que with Que.mode = :off so that we can process jobs in a dedicated worker process, via the rake que:work task. After upgrading to v0.8.0, this has stopped processing jobs for us.
I've reproduced this issue in a vanilla Rails 4.1 app. The steps I took were:
-
rails new test_que
-
Added gem "que" to the Gemfile and ran bundle
-
Added config/initializers/que.rb with Que.mode = :off as the only content
-
Added a tiny job class to test with, such as:
class TestJob < Que::Job
def run
puts "I'm done!"
end
end
-
Ran rake que:work
-
Over in another terminal tab, opened rails console and entered TestJob.enqueue
-
Back in the tab with the rake task, I watch the output and see nothing new about processing that TestJob.
If I do all of these steps with gem "que", "0.7.3" in my Gemfile, then everything works. I run TestJob.enqueue and output about processing the job immediately appears in the shell running the rake que:work task.
Looking over your changes in v0.8.0, it looks like this might be the cause of the issue. It looks like the code for the worker to actually process the jobs only ever gets activated if Que.mode = :async. This would be fine if you wanted Que in :async mode, but when you want it :off, to allow the dedicated worker process, it seems like nothing ever happens.
Am I understanding all of this right? Would a fix be to change that conditional to check for either :async or :off as the Que mode? Anyway, I hope this is enough information for you to look into the issue. Thank you!
Hi there,
We use Que with
Que.mode = :offso that we can process jobs in a dedicated worker process, via therake que:worktask. After upgrading to v0.8.0, this has stopped processing jobs for us.I've reproduced this issue in a vanilla Rails 4.1 app. The steps I took were:
rails new test_queAdded
gem "que"to theGemfileand ranbundleAdded
config/initializers/que.rbwithQue.mode = :offas the only contentAdded a tiny job class to test with, such as:
Ran
rake que:workOver in another terminal tab, opened
rails consoleand enteredTestJob.enqueueBack in the tab with the rake task, I watch the output and see nothing new about processing that
TestJob.If I do all of these steps with
gem "que", "0.7.3"in myGemfile, then everything works. I runTestJob.enqueueand output about processing the job immediately appears in the shell running therake que:worktask.Looking over your changes in v0.8.0, it looks like this might be the cause of the issue. It looks like the code for the worker to actually process the jobs only ever gets activated if
Que.mode = :async. This would be fine if you wanted Que in:asyncmode, but when you want it:off, to allow the dedicated worker process, it seems like nothing ever happens.Am I understanding all of this right? Would a fix be to change that conditional to check for either
:asyncor:offas the Que mode? Anyway, I hope this is enough information for you to look into the issue. Thank you!