Sha256: d5d1834e9ccc950aca859c2f5949bee79e48e66a5e85805818d7ad84c701bc7f
Contents?: true
Size: 790 Bytes
Versions: 2
Compression:
Stored size: 790 Bytes
Contents
require 'sidekiq/util' require 'sidekiq/middleware' require 'celluloid' module Sidekiq class Processor include Util include Celluloid def initialize(boss) @boss = boss end def process(msg) klass = constantize(msg['class']) invoke_chain(klass.new, msg) @boss.processor_done!(current_actor) end def invoke_chain(worker, msg) chain = Sidekiq::Middleware::Chain.retrieve.dup traverse_chain = lambda do if chain.empty? worker.perform(*msg['args']) else chain.shift.call(worker, msg, &traverse_chain) end end traverse_chain.call end # See http://github.com/tarcieri/celluloid/issues/22 def inspect "Sidekiq::Processor<#{object_id}>" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-0.5.1 | lib/sidekiq/processor.rb |
sidekiq-0.5.0 | lib/sidekiq/processor.rb |