1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Revert Celluloid's exclusive mode

This commit is contained in:
Mike Perham 2012-08-16 18:12:25 -07:00
parent e55979407a
commit bd04dcc036

View file

@ -15,8 +15,6 @@ module Sidekiq
include Util
include Celluloid
exclusive :process if ENV['SIDEKIQ_EXCLUSIVE']
def self.default_middleware
Middleware::Chain.new do |m|
m.add Middleware::Server::Logging
@ -31,19 +29,26 @@ module Sidekiq
end
def process(msgstr, queue)
msg = Sidekiq.load_json(msgstr)
klass = constantize(msg['class'])
worker = klass.new
# Defer worker execution to Celluloid's thread pool since all actor
# invocations are run within a Fiber, which dramatically limits
# our stack size.
defer do
begin
msg = Sidekiq.load_json(msgstr)
klass = constantize(msg['class'])
worker = klass.new
stats(worker, msg, queue) do
Sidekiq.server_middleware.invoke(worker, msg, queue) do
worker.perform(*cloned(msg['args']))
stats(worker, msg, queue) do
Sidekiq.server_middleware.invoke(worker, msg, queue) do
worker.perform(*cloned(msg['args']))
end
end
rescue => ex
handle_exception(ex, msg || { :message => msgstr })
raise
end
end
@boss.processor_done!(current_actor)
rescue => ex
handle_exception(ex, msg || { :message => msgstr })
raise
end
# See http://github.com/tarcieri/celluloid/issues/22