Skip to content

Commit

Permalink
pass poll seconds from settings to stream
Browse files Browse the repository at this point in the history
  • Loading branch information
durandom committed Jan 13, 2017
1 parent baed4bf commit 9c43104
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,7 +27,7 @@ def poll
yield activity
@last_activity = activity
end
sleep(20)
sleep @poll_sleep
end
rescue => exception
raise ProviderUnreachable, exception.message
Expand Down
2 changes: 1 addition & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9c43104

Please sign in to comment.