From 467dd39281e30a9929269062802db32b109222f7 Mon Sep 17 00:00:00 2001 From: Kevin Olbrich Date: Thu, 2 Jan 2014 21:14:40 +0000 Subject: [PATCH] perhaps make more threadsafe --- lib/fog/joyent/analytics.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/fog/joyent/analytics.rb b/lib/fog/joyent/analytics.rb index 40c91264f..0b9a62225 100644 --- a/lib/fog/joyent/analytics.rb +++ b/lib/fog/joyent/analytics.rb @@ -1,5 +1,6 @@ require 'fog/joyent' require 'fog/joyent/errors' +require 'thread' module Fog module Joyent @@ -60,6 +61,7 @@ module Fog def initialize(options = {}) @joyent_username = options[:joyent_username] || Fog.credentials[:joyent_username] @joyent_password = options[:joyent_password] || Fog.credentials[:joyent_password] + @mutex = Mutex.new end def request(opts) @@ -161,8 +163,10 @@ module Fog date = Time.now.utc.httpdate # Force KeyManager to load the key(s) - @key_manager.each_identity {} - + @mutex.synchronize do + @key_manager.each_identity {} + end + key = @key_manager.known_identities.keys.first sig = if key.kind_of? OpenSSL::PKey::RSA