app/lib/actions/katello/event_queue/poller_thread.rb in katello-3.6.0.1.rc2 vs app/lib/actions/katello/event_queue/poller_thread.rb in katello-3.7.0.rc1
- old
+ new
@@ -24,18 +24,20 @@
def poll_for_events(suspended_action)
@thread.kill if @thread
@thread = Thread.new do
loop do
- begin
- until (event = ::Katello::EventQueue.next_event).nil?
- suspended_action.notify_queue_item(event.event_type, event.object_id, event.created_at) if event
- end
+ Rails.application.executor.wrap do
+ begin
+ until (event = ::Katello::EventQueue.next_event).nil?
+ suspended_action.notify_queue_item(event.event_type, event.object_id, event.created_at) if event
+ end
- sleep SLEEP_INTERVAL
- rescue => e
- suspended_action.notify_fatal(e)
- raise e
+ sleep SLEEP_INTERVAL
+ rescue => e
+ suspended_action.notify_fatal(e)
+ raise e
+ end
end
end
end
end
end