Skip to content
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

Merged
merged 1 commit into from
Nov 6, 2017
Merged

Conversation

juliancheal
Copy link
Member

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.

@juliancheal
Copy link
Member Author

@miq-bot add_label gaprindashvili/yes

@juliancheal
Copy link
Member Author

@miq-bot assign @Fryguy

@juliancheal
Copy link
Member Author

So I think sorting the arrays straight out of the db should always create sorted queue names.

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.
@miq-bot
Copy link
Member

miq-bot commented Nov 6, 2017

Checked commit juliancheal@db6a096 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@@ -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
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fryguy Fryguy merged commit 619b5b8 into ManageIQ:master Nov 6, 2017
@Fryguy Fryguy modified the milestones: Roadmap, Sprint 73 Ending Nov 13, 2017 Nov 6, 2017
simaishi pushed a commit that referenced this pull request Nov 6, 2017
Sort array of queue names
(cherry picked from commit 619b5b8)
@simaishi
Copy link
Contributor

simaishi commented Nov 6, 2017

Gaprindashvili backport details:

$ git log -1
commit 0cd457eceb5b690c2034db4d3ebe7be564d313b4
Author: Jason Frey <[email protected]>
Date:   Mon Nov 6 15:10:26 2017 -0500

    Merge pull request #16400 from juliancheal/order_array_queues
    
    Sort array of queue names
    (cherry picked from commit 619b5b8e5394aa70dce5886ec7737c6ae6fc16d7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants