Sha256: 4ee9016c120f9faab82cce32fcde394ef9b76e53fec6502213ce78a322b28a8b
Contents?: true
Size: 1.13 KB
Versions: 10
Compression:
Stored size: 1.13 KB
Contents
module Actions module Katello module EventQueue class PollerThread SLEEP_INTERVAL = 2 cattr_accessor :instance def self.initialize(logger) self.instance ||= self.new(logger) end def self.close self.instance.close if self.instance self.instance = nil end def initialize(logger) @logger = logger end def close @thread.kill if @thread end def poll_for_events(suspended_action) @thread.kill if @thread @thread = Thread.new do loop do 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 end end end end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems