-
Notifications
You must be signed in to change notification settings - Fork 152
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 Worker#work_off
and rake qc:work_off
.
#256
base: master
Are you sure you want to change the base?
Conversation
This provides a way to work off all the jobs in the queue and exit afterwards. Closes #191.
@smathieu @jipiboily thoughts? |
👍
|
I would expect a task named |
The code is fine, but I worry about how this project is evolving. QC was originally designed (as far as I understand) to have a simple and limited interface for workers. This would allow users of QC to create their own subclass of the worker class and override some method. It seems that over the year, the size of the worker interface has kept growing, making it less approachable to override. For instance, if someone overrode the Something to think about I guess. |
@smathieu I agree with everything you say. I also do think that this functionality should be part of the limited interface we provide. The PR was created to be fully backwards compatible but as you pointed out, this is a tradeoff in other areas. Depending on wether this lands in a major or minor we might have more flexibility to rework the internals. I'd like to see a more approachable interface as well. @jipiboily any thoughts on a roadmap? |
I'm on the fence on that one. I don't have a strong opinion, but it doesn't feel like something that most people will use. The more I think about qc, the more I think it should keep a tight scope, stay easily approachable and modifiable. To achieve this, I think we should mostly add stuff that will be used by the majority of the people using qc. Are there any other use cases you can think of? The original one (using this on Heroku to avoid paying for a full dyno) seems like something very few people will do, and it's easy to work around it. |
And by the way, my life changed a bit in the last couple months, you might have seen I don't have much time to work on qc or any open source stuff, and I don't think this will change anytime soon. Basically, don't wait for me if you want to be able to move at a decent pace :) |
I still feel we should put this in. Some use-cases I've came across where this would be very helpful.
|
I don't have a strong opinion, so either way is fine IMHO. |
This makes sense and has precedent: delayed_job has a Agreed, a cron job is a good example where this feature would be needed. Another would be spinning up an expensive host twice a day to drain the queue. I'd like to see this feature. That said, I agree with @smathieu... It's worth worrying if QC's internals are getting weirder. For example, in this PR, Is it OK to make minor changes to But maybe it's not OK... Since the docs recommend overriding Worker to manage connections (!), and nobody put any |
@senny has convinced me that this is valuable, but I'm still not convinced this interface is the right one. Maybe we can limit the scope of change by making the |
I'm not in charge of any Rails projects anymore. Hope you can do it @ukd1! |
I'm not sure if Our Que specs use this helper: def run_que_synchronously
Que.run_synchronously = true
yield
ensure
Que.run_synchronously = false
end
it "runs jobs inline without needing a worker" do
run_que_synchronously do
Job.enqueue()
OtherJob.enqueue()
end
end |
This provides a way to work off all the jobs in the queue
and exit afterwards.
Closes #191.