Working with Resque? perform_later is at 1.0, you should use it

Last night, I released the 1.0 version of perform_later.

Now or 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.

What’s new?

  • 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::Base
  def long_running_method
    # Your code here
  end
  later :long_running_method

  def long_running_method_2
    # Your code here
  end
  later :long_running_method_2, queue: :some_queue_name

  def lonely_long_running_method
    # Your code here
  end
  later :lonely_long_running_method, :loner => true, queue: :some_queue_name
end
view raw user.rb This Gist brought to you by GitHub.

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.

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com