From b2a1df75680d3fd081da38e82e3a2f22dcb2b806 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Fri, 16 Feb 2018 15:44:25 -0500 Subject: [PATCH] if there is task linked to queue item than make this task ACTIVE when deliver --- app/models/miq_queue.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/miq_queue.rb b/app/models/miq_queue.rb index cab02838888c..4b9f4cb16b7c 100644 --- a/app/models/miq_queue.rb +++ b/app/models/miq_queue.rb @@ -447,6 +447,7 @@ def deliver(requester = nil) def dispatch_method(obj, args) Timeout.timeout(msg_timeout) do + args = activate_miq_task(args) obj.send(method_name, *args) end end @@ -542,6 +543,13 @@ def self.get_worker(task_id) private + def activate_miq_task(args) + MiqTask.update_status(miq_task_id, MiqTask::STATE_ACTIVE, MiqTask::STATUS_OK, "Task starting") if miq_task + pars = args.first + pars[:miq_task_id] = miq_task_id if pars.kind_of?(Hash) + args + end + # default values for get operations def self.default_get_options(options) options.reverse_merge(