Skip to content

Commit

Permalink
Initialize MiqQueu#miq_task_id column when creating queue item, or ov…
Browse files Browse the repository at this point in the history
…erride existing value if second task created for the already queued request. Having MiqQueue#miq_task_id column initialized will allow automaticly populate MiqTask_started_on when queed metric capture command delivered. It become possible after merginghttps://github.com//pull/17015.

related BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1543289
  • Loading branch information
yrudman committed Apr 17, 2018
1 parent 05e85b1 commit 82f0cdc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/models/metric/ci_mixin/capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def perf_capture_queue(interval_name, options = {})
queue_item_options = queue_item.merge(:method_name => "perf_capture_#{item_interval}")
queue_item_options[:args] = start_and_end_time if start_and_end_time.present?
next if item_interval != 'realtime' && messages[start_and_end_time].try(:priority) == priority
MiqQueue.put_or_update(queue_item_options) do |msg, qi|
msg = MiqQueue.put_or_update(queue_item_options) do |msg, qi|
if msg.nil?
qi[:priority] = priority
qi.delete(:state)
Expand All @@ -110,6 +110,9 @@ def perf_capture_queue(interval_name, options = {})
nil
end
end
# main reason for setting miq_task_id is to initializes MiqTask.started_on column when message delivered.
# there is no harm to update miq_task_id twice (if job is still running)
msg.update_attributes(:miq_task_id => task_id) if task_id
end
end

Expand Down

0 comments on commit 82f0cdc

Please sign in to comment.