From db6a096ebd97d09ab0a58d41c5518e3f69a46d58 Mon Sep 17 00:00:00 2001 From: Julian Cheal Date: Mon, 6 Nov 2017 15:09:48 +0000 Subject: [PATCH] Sort array of 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. --- app/models/miq_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/miq_worker.rb b/app/models/miq_worker.rb index bc12d0a7956..e0ccb641d6e 100644 --- a/app/models/miq_worker.rb +++ b/app/models/miq_worker.rb @@ -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 rescue JSON::ParserError, TypeError self[:queue_name] end