From b6e1bf8ae4d567da2e6ffe7239ee5d7c33f4ef7d Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 14 Nov 2012 14:05:55 +0100 Subject: [PATCH] appflow: Fix bug where strings and ints were used to store service mutex. Use always int ids. --- flow/models/ServicePool.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/flow/models/ServicePool.rb b/flow/models/ServicePool.rb index 5ac05098c3..cf646b5efd 100644 --- a/flow/models/ServicePool.rb +++ b/flow/models/ServicePool.rb @@ -18,6 +18,9 @@ module OpenNebula DOCUMENT_TYPE = 100 + @@mutex = Mutex.new + @@mutex_hash = Hash.new + # Class constructor # # @param [OpenNebula::Client] client the xml-rpc client @@ -27,9 +30,6 @@ module OpenNebula # @return [DocumentPool] the new object def initialize(client, user_id=-1) super(client, user_id) - - @@mutex ||= Mutex.new - @@mutex_hash ||= Hash.new end def factory(element_xml) @@ -47,7 +47,7 @@ module OpenNebula # # @return [Service, OpenNebula::Error] The Service in case of success def get(service_id, &block) - + service_id = service_id.to_i if service_id service = Service.new_with_id(service_id, @client) rc = service.info @@ -66,7 +66,6 @@ module OpenNebula if entry.nil? entry = [Mutex.new, 0] - @@mutex_hash[service_id] = entry end