Module: Trailblazer::Operation::Worker

Defined in:
lib/trailblazer/1.1/operation/worker.rb

Overview

only kicks in when Operation::run, #run will still do it real-time Works with Reform 2, only.

Defined Under Namespace

Modules: ClassMethods, FileMarshaller

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



10
11
12
13
# File 'lib/trailblazer/1.1/operation/worker.rb', line 10

def self.included(base)
  base.send(:include, Sidekiq::Worker)
  base.extend(ClassMethods)
end

Instance Method Details

#performObject

(params)



54
55
56
57
58
59
60
61
62
63
# File 'lib/trailblazer/1.1/operation/worker.rb', line 54

def perform#(params)
  # the serialized params hash from Sidekiq contains a Op::UploadedFile hash.

  # the following code is basically what happens in a controller.
  # this is a bug in Rails, it doesn't work without requiring as/hash/ina
  # params = ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default(params) # TODO: this might make it ultra-slow as Reform converts it back to strings.
  params = @params.with_indifferent_access
  @params = deserializable(params)
  run
end