nesquena / backburner

Simple and reliable beanstalkd job queue for ruby
http://nesquena.github.com/backburner
MIT License
428 stars 68 forks source link

Feature request: Create the equivalent of DelayedJob's handle_asynchronously #92

Closed contentfree closed 9 years ago

contentfree commented 9 years ago

This is one of the nicest features of DelayedJob. It's very useful to not have to think about the seams of where you need async work to be done, instead being able to configure those in the production environment with #handle_asynchronously.

The method allows for configuring queue properties as well (name, priority, etc).

nesquena commented 9 years ago

Yes, I've certainly thought about this being a nice feature to have. It's a natural convenience on top of .async https://github.com/nesquena/backburner#simple-async-jobs.

contentfree commented 9 years ago

How applicable is the strategy that DJ is using? I assume that Backburner wouldn't want to pollute the object space as DJ does, but maybe there's a happy medium. Maybe have a static method on the Performable module that could take a class and a method name and create a proxy?

nesquena commented 9 years ago

Yep that's the approach I was thinking too. Wouldn't be too much work. In short, add it to Performable and then just automagically rewrite the method to call async on the original method.

contentfree commented 9 years ago

Another thing that DJ does that BB will probably have a differing opinion on is that the instance and the arguments get serialized themselves. From BB's examples it looks like they all use IDs which is great when you're designing for async out of the gate, but might be a problem when doing automagic behaviour. I haven't looked closely enough but does BB serialize instances if it runs across them? (It's not hugely efficient to do so, of course, but might be necessary here)

contentfree commented 9 years ago

I'm thinking that this would be how it works (see the last test): https://gist.github.com/b310d568689ac66ac190. Basically a straight rip of DJ.

contentfree commented 9 years ago

Thoughts on this?

contentfree commented 9 years ago

@nesquena : Have you had a chance to evaluate the above?

contentfree commented 9 years ago

I created a pull request for this: https://github.com/nesquena/backburner/pull/98

nesquena commented 9 years ago

You've been doing a great job here, I like the changes you've been making to backburner. Can you make sure to add to the README to reflect each feature you add. I will pull in all your changes and cut a new release soon. Would you be interested in being a core contributor, I certainly need help keeping backburner going.

contentfree commented 9 years ago

Happy to help. Do you want me to redo those or just add another commit after they're pulled in?

On Aug 30, 2015, at 10:34, Nathan Esquenazi notifications@github.com wrote:

You've been doing a great job here, I like the changes you've been making to backburner. Can you make sure to add to the README to reflect each feature you add. I will pull in all your changes and cut a new release soon. Would you be interested in being a core contributor, I certainly need help keeping backburner going.

— Reply to this email directly or view it on GitHub.

nesquena commented 9 years ago

However you want to do it. You could add all the new features into the readme in a separate pull request or you could push a new commit to the existing branches. Whatever is easiest for you.

contentfree commented 9 years ago

Done. Updated each branch separately and updated the Pull Requests.​

contentfree commented 9 years ago

This is closed once #100 is merged in