lib/toiler/actor/processor.rb in toiler-0.5.0 vs lib/toiler/actor/processor.rb in toiler-0.5.1.pre1
- old
+ new
@@ -15,11 +15,10 @@
@worker_class = Toiler.worker_class_registry[queue]
@fetcher = Toiler.fetcher queue
@executing = Concurrent::AtomicBoolean.new
@thread = nil
init_options
- processor_finished
end
def default_executor
Concurrent.global_io_executor
end
@@ -87,11 +86,12 @@
fetcher.tell :processor_finished
end
def visibility_extender(queue_visibility, sqs_msg, body)
return unless auto_visibility_timeout?
- interval = [1,queue_visibility/3].max
+
+ interval = [1, queue_visibility / 3].max
Concurrent::TimerTask.execute execution_interval: interval,
timeout_interval: interval do
begin
sqs_msg.visibility_timeout = queue_visibility
yield sqs_msg, body if block_given?
@@ -114,10 +114,10 @@
when :json then JSON.parse sqs_msg.body
when Proc then body_parser.call sqs_msg
when :text, nil then sqs_msg.body
else body_parser.load sqs_msg.body
end
- rescue => e
+ rescue StandardError => e
raise "Error parsing the message body: #{e.message}"
end
end
end
end