WindowsAzure/azure-sdk-for-ruby — pull request #72 by Blackmist (2013-05-28 17:26:20+00:00)
Title: Fixing retry

exception so it can be used/evaluated by retry logic.

To use, do something like:

require "azure"
require "azure/core/http/debug_filter"
require "azure/core/http/retry_policy"
retry_thing = Azure::Core::Http::RetryPolicy.new { |response, data|
return false unless data.has_key?(:error)
if data.has_key?(:count) then
data[:count] += 1
return false if data[:count] > 3
else
data[:count] = 0
end
puts "current count #{data[:count]}"
return true
}

This checks to see if an error was captured, and if so initializes a retry count, then increments each retry attempt, finally returning false when count > 3.