Skip to content

Commit

Permalink
adding limit of number of last processed servers to record. In some s…
Browse files Browse the repository at this point in the history
…ituation miq_request my started constantly requeuing
  • Loading branch information
yrudman committed Jul 11, 2019
1 parent 6b64bb6 commit f2b9f5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/mixins/miq_request_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,11 @@ def dialog_zone
zone
end

LOG_SERVERS_LIMIT = 10
def mark_execution_servers
options[:executed_on_servers] ||= []
options[:executed_on_servers] << MiqServer.my_server.id
options[:executed_on_servers].shift if options[:executed_on_servers].size > LOG_SERVERS_LIMIT
update_attributes(:options => options)
end
end
7 changes: 7 additions & 0 deletions spec/models/service_template_provision_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ def service_resource_id(index, scaling_max)
@task_0.mark_execution_servers
expect(@task_0.options[:executed_on_servers]).to eq([server.id, server.id])
end

it "limits number of logged servers to the last 10 (defined in MiqRequestMixin::LOG_SERVERS_LIMIT)" do
@task_0.options[:executed_on_servers] = Array.new(MiqRequestMixin::LOG_SERVERS_LIMIT)
@task_0.mark_execution_servers

expect(@task_0.options[:executed_on_servers].size).to eq(MiqRequestMixin::LOG_SERVERS_LIMIT)
end
end
end
end

0 comments on commit f2b9f5a

Please sign in to comment.