From 66a140638c28703e26e2f78e5675b3e9887f15eb Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Fri, 31 Jan 2020 11:33:24 -0500 Subject: [PATCH] Revert "Merge pull request #19788 from agrare/remove_process_messages_from_server" This reverts commit 9ff0a84778aff5ac9cb21e3bf79eb69680059a55, reversing changes made to 3fb04b02ad7fab8a880e3601414ac158a664852a. --- app/models/miq_worker/runner.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/models/miq_worker/runner.rb b/app/models/miq_worker/runner.rb index 7de832b024f6..70fb3542295d 100644 --- a/app/models/miq_worker/runner.rb +++ b/app/models/miq_worker/runner.rb @@ -288,6 +288,8 @@ def heartbeat _log.info("#{log_prefix} Synchronizing configuration complete...") end + process_messages_from_server unless MiqEnvironment::Command.is_podified? + @last_hb = now do_heartbeat_work rescue SystemExit, SignalException @@ -296,6 +298,15 @@ def heartbeat do_exit("Error heartbeating because #{err.class.name}: #{err.message}\n#{err.backtrace.join('\n')}", 1) end + def process_messages_from_server + worker_monitor_drb.register_worker(@worker.pid, @worker.class.name, @worker.queue_name) + worker_monitor_drb.worker_get_messages(@worker.pid).each do |msg, *args| + process_message(msg, *args) + end + rescue DRb::DRbError => err + do_exit("Error processing messages from MiqServer because #{err.class.name}: #{err.message}", 1) + end + def heartbeat_to_file(timeout = nil) # Disable heartbeat check. Useful if a worker is running in isolation # without the oversight of MiqServer::WorkerManagement