-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use MiqTask for EmsRefresh and remove sync option #14027
Conversation
6108e29
to
c9f539c
Compare
c9f539c
to
dc388c6
Compare
This pull request is not mergeable. Please rebase and repush. |
2434fb3
to
4f5db79
Compare
This pull request is not mergeable. Please rebase and repush. |
4f5db79
to
3513a8b
Compare
4ef3d70
to
bb501d5
Compare
Okay @Fryguy I made creation of the task optional, and added a method that will return a task so that if you know you need one you can call I think we can get rid of the Ansible |
0945432
to
68f603d
Compare
app/models/ems_refresh.rb
Outdated
sync ? queue_merge_sync(targets, ems) : queue_merge_async(targets, ems) | ||
end | ||
def self.queue_merge(targets, ems, create_task = false) | ||
task = create_refresh_task(ems, targets) if create_task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this end up creating a task even if there is already one on the queue?
app/models/ems_refresh.rb
Outdated
|
||
# If we merged with an existing queue item we don't need a new | ||
# task, just use the original one | ||
task.delete if task && task_id != task.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's here...wonder if there's a nicer way to do this so as not to create then destroy it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could create the task in the put_or_update
block if msg
is nil
Checked commits agrare/manageiq@4d7b386~...b8c9343 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
If this gets backported -> then #14441 should be as well. |
This wraps the EmsRefresh queue item in an MiqTask so that the task_ids can be aggregated by the caller and
MiqTask::wait_for_task_id
can be used instead of the current "sync" refresh option which just sleeps on the queue item, blocking refreshes on other EMSs from being queued.In the event that a queue item gets merged, the original task_id is returned.
Note: this doesn't fix the issue where the worker is blocked from processing other work while waiting for a refresh. We cannot use the queue callbacks to run work after the refresh completes because if a refresh is merged there will be only one queue callback.