Skip to content

Commit

Permalink
Merge pull request #18124 from yrudman/customizable-timeout-when-db-b…
Browse files Browse the repository at this point in the history
…ackup

Use Settings.active_task_timeout for db backup task  instead of hardcoded value
  • Loading branch information
gtanzillo authored Oct 31, 2018
2 parents 8340f7c + 939f7fd commit 079996b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/miq_schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def action_db_backup(klass, _at)
opts = self.sched_action[:options]
opts[:file_depot_id] = file_depot.id
opts[:miq_schedule_id] = id
queue_opts = {:class_name => klass.name, :method_name => "backup", :msg_timeout => 3600, :args => [opts], :role => "database_operations"}
queue_opts = {:class_name => klass.name, :method_name => "backup", :args => [opts], :role => "database_operations",
:msg_timeout => ::Settings.task.active_task_timeout.to_i_with_method}
task_opts = {:action => "Database backup", :userid => self.sched_action[:options][:userid]}
MiqTask.generic_action_with_callback(task_opts, queue_opts)
end
Expand Down
4 changes: 4 additions & 0 deletions spec/models/miq_schedule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,10 @@
it "should create one backup queue message for our db backup instance for the database role" do
expect(MiqQueue.where(:class_name => "DatabaseBackup", :method_name => "backup", :role => "database_operations").count).to eq(1)
end

it "sets backup tasks's timeout to ::Settings.task.active_task_timeout" do
expect(@backup_message.msg_timeout).to eq ::Settings.task.active_task_timeout.to_i_with_method
end
end

context "calling queue scheduled work via a db_backup schedule firing" do
Expand Down

0 comments on commit 079996b

Please sign in to comment.