module Backburner::Performable::ClassMethods
Public Instance Methods
async(opts={})
click to toggle source
Return proxy object to enqueue jobs for object Options: `pri` (priority), `delay` (delay in secs), `ttr` (time to respond), `queue` (queue name) @example
Model.async(:ttr => 300).do_something("foo")
# File lib/backburner/performable.rb, line 27 def async(opts={}) Backburner::AsyncProxy.new(self, nil, opts) end
handle_asynchronously(method, opts={})
click to toggle source
Always handle an instance method asynchronously @example
User.handle_asynchronously :send_welcome_email, queue: 'send-mail', delay: 10
# File lib/backburner/performable.rb, line 45 def handle_asynchronously(method, opts={}) Backburner::Performable.handle_asynchronously(self, method, opts) end
handle_static_asynchronously(method, opts={})
click to toggle source
Always handle a class method asynchronously @example
User.handle_static_asynchronously :update_recent_visitors, ttr: 300
# File lib/backburner/performable.rb, line 52 def handle_static_asynchronously(method, opts={}) Backburner::Performable.handle_static_asynchronously(self, method, opts) end
perform(id, method, *args)
click to toggle source
Defines perform method for job processing @example
perform(55, :do_something, "foo", "bar")
# File lib/backburner/performable.rb, line 34 def perform(id, method, *args) if id # instance find(id).send(method, *args) else # class method send(method, *args) end end