-
Notifications
You must be signed in to change notification settings - Fork 897
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
Sort array of queue names #16400
Sort array of queue names #16400
Conversation
@miq-bot add_label gaprindashvili/yes |
So I think |
Queue names can get out of numerical order, this can make it tough to compare two arrays of queues as sometimes we need to turn those arrays into Ruby Strings. For example a queue of `["ems_1", "ems_3", "ems_2"]` from the database would not equal `["ems_1", "ems_2", "ems_3"]` if both were strings.
3fe13ef
to
db6a096
Compare
Checked commit juliancheal@db6a096 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 |
@@ -336,7 +336,7 @@ def self.close_pg_sockets_inherited_from_parent | |||
# This converts it back to a Ruby Array safely. | |||
def queue_name | |||
begin | |||
JSON.parse(self[:queue_name]) | |||
JSON.parse(self[:queue_name]).sort |
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.
Will this handle a single queue_name that's not an array?
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.
@Fryguy that happens here https://github.com/juliancheal/manageiq/blob/db6a096ebd97d09ab0a58d41c5518e3f69a46d58/app/models/miq_worker.rb#L340-L342 If JSON
tries to parse a string.
Sort array of queue names (cherry picked from commit 619b5b8)
Gaprindashvili backport details:
|
Queue names can get out of numerical order, this can make it tough
to compare two arrays of queues as sometimes we need to turn those
arrays into Ruby Strings.
For example a queue of
["ems_1", "ems_3", "ems_2"]
from the databasewould not equal
["ems_1", "ems_2", "ems_3"]
if both were strings.