Skip to content

Commit

Permalink
Reverse the default of wait_for_worker_monitor
Browse files Browse the repository at this point in the history
A majority of workers do not need to wait for the server to start, so
changing the default simplifies the code and also identifies which
workers actually need to wait.  In researching this, we found that the
only reason that workers are waiting is to actually wait for the vmware
broker to start and provide its connection pool.  Follow up PRs will
change this from wait_for_worker_monitor to "wait for broker", and we
can further make this more specific to vmware only classes.

See also
#14257 (comment)
for a description of how the wait_for_worker_monitor manifests as a
"wait for broker" scenario.
  • Loading branch information
Fryguy committed Jul 25, 2017
1 parent 7e1997a commit 9e99ba0
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 15 deletions.
2 changes: 0 additions & 2 deletions app/models/embedded_ansible_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class EmbeddedAnsibleWorker::Runner < MiqWorker::Runner
self.wait_for_worker_monitor = false

def prepare
ObjectSpace.garbage_collect
# Overriding prepare so we can set started when we're ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ class EventCatcherHandledException < StandardError

include DuplicateBlocker

self.wait_for_worker_monitor = false

OPTIONS_PARSER_SETTINGS = ::MiqWorker::Runner::OPTIONS_PARSER_SETTINGS + [
[:ems_id, 'EMS Instance ID', String],
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class ManageIQ::Providers::BaseManager::MetricsCollectorWorker::Runner < ::MiqQueueWorkerBase::Runner
self.wait_for_worker_monitor = true # NOTE: Really means wait for broker to start for ems_metrics_collector role, TODO: only for VMware
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ class ManageIQ::Providers::BaseManager::RefreshWorker::Runner < ::MiqQueueWorker
[:ems_id, 'EMS Instance ID', String],
]

self.wait_for_worker_monitor = true # NOTE: Really means wait for broker for ems_inventory role, TODO: only for VMware

def log_prefix
@log_prefix ||= "EMS [#{@ems.hostname}] as [#{@ems.authentication_userid}]"
end
Expand Down
2 changes: 0 additions & 2 deletions app/models/miq_ems_refresh_core_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
require 'thread'

class MiqEmsRefreshCoreWorker::Runner < MiqWorker::Runner
self.wait_for_worker_monitor = false

OPTIONS_PARSER_SETTINGS = MiqWorker::Runner::OPTIONS_PARSER_SETTINGS + [
[:ems_id, 'EMS Instance ID', String],
]
Expand Down
1 change: 1 addition & 0 deletions app/models/miq_generic_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class MiqGenericWorker::Runner < MiqQueueWorkerBase::Runner
self.wait_for_worker_monitor = true # NOTE: Really means wait for broker to start because of ems_operations and smartstate roles
end
1 change: 0 additions & 1 deletion app/models/miq_priority_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
class MiqPriorityWorker::Runner < MiqQueueWorkerBase::Runner
self.wait_for_worker_monitor = false
end
1 change: 1 addition & 0 deletions app/models/miq_smart_proxy_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
class MiqSmartProxyWorker::Runner < MiqQueueWorkerBase::Runner
self.wait_for_worker_monitor = true # NOTE: Really means wait for broker to start for smartproxy role
end
2 changes: 0 additions & 2 deletions app/models/miq_vim_broker_worker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class MiqVimBrokerWorker::Runner < MiqWorker::Runner
self.wait_for_worker_monitor = false

def after_initialize
require 'thread'

Expand Down
3 changes: 1 addition & 2 deletions app/models/miq_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def set_connection_pool_size
###############################

def self.wait_for_worker_monitor?
@wait_for_worker_monitor = true if @wait_for_worker_monitor.nil?
@wait_for_worker_monitor
!!@wait_for_worker_monitor
end

class << self
Expand Down
4 changes: 0 additions & 4 deletions app/models/mixins/miq_web_server_runner_mixin.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module MiqWebServerRunnerMixin
extend ActiveSupport::Concern

included do
self.wait_for_worker_monitor = false
end

def do_work
end

Expand Down

0 comments on commit 9e99ba0

Please sign in to comment.