module Operation::Worker::ClassMethods
Public Instance Methods
jid=(jid)
click to toggle source
# File lib/trailblazer/operation/worker.rb, line 34 def jid=(jid) puts "@@@@@ #{jid.inspect}" end
new(*args)
click to toggle source
Calls superclass method
# File lib/trailblazer/operation/worker.rb, line 24 def new(*args) return super if args.any? # sidekiq behavior: (not a big fan of this) self end
perform(params)
click to toggle source
# File lib/trailblazer/operation/worker.rb, line 30 def perform(params) # called by Sidekiq. build_operation(params).perform end
run(params)
click to toggle source
Calls superclass method
# File lib/trailblazer/operation/worker.rb, line 16 def run(params) if background? return perform_async(serializable(params)) end super(params) end
Private Instance Methods
background?()
click to toggle source
# File lib/trailblazer/operation/worker.rb, line 43 def background? # TODO: make configurable. true # if Rails.env == "production" or Rails.env == "staging" end
perform_async(*args)
click to toggle source
# File lib/trailblazer/operation/worker.rb, line 39 def perform_async(*args) client_push('class' => self, 'args' => args) # calls class.new.perform(params) end
serializable(params)
click to toggle source
# File lib/trailblazer/operation/worker.rb, line 48 def serializable(params) params # this is where we convert file uloads into Trailblazer::UploadedFile, etc. soon. end