lib/upperkut/batch_execution.rb in upperkut-0.7.5 vs lib/upperkut/batch_execution.rb in upperkut-0.8.0
- old
+ new
@@ -10,33 +10,29 @@
end
def execute
worker_instance = @worker.new
items = @worker.fetch_items.freeze
+ items_body = items.map(&:body)
- items_body = items.collect do |item|
- item['body']
- end
-
@worker.server_middlewares.invoke(@worker, items) do
worker_instance.perform(items_body.dup)
end
rescue StandardError => error
@logger.info(
action: :requeue,
ex: error,
- item_size: items_body.size
+ item_size: items.size
)
@logger.error(error.backtrace.join("\n"))
if worker_instance.respond_to?(:handle_error)
worker_instance.handle_error(error, items_body)
return
- else
- @worker.push_items(items_body)
end
+ @worker.push_items(items)
raise error
end
end
end