Working with Resque? perform_later is at 1.0, you should use it
Last night, I released the 1.0 version of perform_later.
The gem is being used in production for over 6 months now, in a big-scale website (Gogobot), so I thought it’s time to put in some extra needed work, some major refactoring and to release 1.0.
- 1.0 is basically the same in the core functionality, I refactored big bits of the codebase, it’s much cleaner and more readable then before (still need to work quite a bit on code documentation)
- Added the later method support for ActiveRecord models.
- Added the loner support, now you can mark methods to be loners, meaning only a single instance of this method can exist in the queue at all times, this is super useful when a user does many actions that will result in say a cache clear for the user, there’s no reason to do a clear more then once. (and there are many more cases like this)
So, right off the README, here’s simple usage for this gem
class User < ActiveRecord::Basedef long_running_method# Your code hereendlater :long_running_methoddef long_running_method_2# Your code hereendlater :long_running_method_2, queue: :some_queue_namedef lonely_long_running_method# Your code hereendlater :lonely_long_running_method, :loner => true, queue: :some_queue_nameend
The best thing about perform_later (not new in this version) is that you can pass in any param, and it will get translated into JSON with no problem.
You can pass in AR objects, hashes, arrays, anything you need, there’s no need to rewrite your methods.
I would love your comments, feel free to contribute issues, pull requests, documentation or anything else.