Skip to content

Commit

Permalink
Merge pull request #22660 from jrafanie/ensure_not_yet_paused_provide…
Browse files Browse the repository at this point in the history
…r_destroys_run_medium_priority_and_extended_timeout

Ensure provider destroy requeue has long timeout
  • Loading branch information
agrare authored Aug 16, 2023
2 parents cd1594a + 3aaf132 commit f0badb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ def destroy_queue(queue_options = {})
:message => msg
)

orchestrate_destroy_queue(task.id, queue_options.reverse_merge(:msg_timeout => 3_600))
orchestrate_destroy_queue(task.id, queue_options)

task.id
end
Expand All @@ -686,7 +686,7 @@ def wait_for_ems_workers_removal
end

def orchestrate_destroy_queue(task_id, queue_options = {})
self.class._queue_task('orchestrate_destroy', [id], task_id, queue_options)
self.class._queue_task('orchestrate_destroy', [id], task_id, queue_options.reverse_merge(:msg_timeout => 3_600))
end

def orchestrate_destroy(task_id = nil)
Expand Down
8 changes: 6 additions & 2 deletions spec/models/ext_management_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,10 @@
it "destroys the ems when no active worker exists" do
ems.destroy_queue

expect(MiqQueue.count).to eq(2)
# test pauses at high priority
# test destroy has extended timeout
expect(MiqQueue.where(:method_name => "pause!", :priority => MiqQueue::HIGH_PRIORITY).count).to eq(1)
expect(MiqQueue.where(:method_name => "orchestrate_destroy", :msg_timeout => 3_600).count).to eq(1)

deliver_queue_message # Deliver the `#pause!` queue item
deliver_queue_message # Deliver the `#orchestrate_destroy` queue item
Expand Down Expand Up @@ -785,7 +788,8 @@
deliver_queue_message(MiqQueue.find_by(:method_name => "orchestrate_destroy"))
deliver_queue_message

expect(MiqQueue.count).to eq(1)
# test non-nil deliver on and extended timeout
expect(MiqQueue.where(:msg_timeout => 3_600).where.not(:deliver_on => nil).count).to eq(1)
expect(ExtManagementSystem.count).to eq(1)

deliver_queue_message
Expand Down

0 comments on commit f0badb7

Please sign in to comment.