From 9c431041b327fbb2983909f5550456796beb78d2 Mon Sep 17 00:00:00 2001 From: Marcel Hild Date: Wed, 11 Jan 2017 18:07:17 +0100 Subject: [PATCH] pass poll seconds from settings to stream --- .../configuration_manager/event_catcher/runner.rb | 5 ++++- .../configuration_manager/event_catcher/stream.rb | 5 +++-- config/settings.yml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/runner.rb b/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/runner.rb index d75e3465306..172d2a53061 100644 --- a/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/runner.rb +++ b/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/runner.rb @@ -24,7 +24,10 @@ def queue_event(event) def event_monitor_handle @event_monitor_handle ||= begin - ManageIQ::Providers::AnsibleTower::ConfigurationManager::EventCatcher::Stream.new(@ems) + ManageIQ::Providers::AnsibleTower::ConfigurationManager::EventCatcher::Stream.new( + @ems, + :poll_sleep => worker_settings[:poll] + ) end end end diff --git a/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/stream.rb b/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/stream.rb index 8787aef69e6..1a25c852a08 100644 --- a/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/stream.rb +++ b/app/models/manageiq/providers/ansible_tower/configuration_manager/event_catcher/stream.rb @@ -2,10 +2,11 @@ class ManageIQ::Providers::AnsibleTower::ConfigurationManager::EventCatcher::Str class ProviderUnreachable < ManageIQ::Providers::BaseManager::EventCatcher::Runner::TemporaryFailure end - def initialize(ems) + def initialize(ems, options = {}) @ems = ems @last_activity = nil @stop_polling = false + @poll_sleep = options[:poll_sleep] || 20.seconds end def start @@ -26,7 +27,7 @@ def poll yield activity @last_activity = activity end - sleep(20) + sleep @poll_sleep end rescue => exception raise ProviderUnreachable, exception.message diff --git a/config/settings.yml b/config/settings.yml index baca29b9f19..f380ac160a7 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -1202,7 +1202,7 @@ :nice_delta: 1 :poll: 1.seconds :event_catcher_ansible_tower: - :poll: 1.seconds + :poll: 20.seconds :event_catcher_redhat: :poll: 15.seconds :event_catcher_vmware: