Fix Dynect job poll bug.

Dynect sometimes gives back HTTP 200 instead of 307.
        https://github.com/Netflix/denominator/issues/261

        We need a workaround for this until it is fixed.
This commit is contained in:
Chris Chalstrom 2014-11-13 10:01:47 -07:00
parent d1a8a64520
commit db6ca8ac29
3 changed files with 12 additions and 4 deletions

View File

@ -11,7 +11,7 @@ Gem::Specification.new do |s|
## If your rubyforge_project name is different, then edit it and comment out
## the sub! line in the Rakefile
s.name = 'fog'
s.version = '1.24.0'
s.version = '1.24.1'
s.date = '2014-10-24'
s.rubyforge_project = 'fog'

View File

@ -102,8 +102,16 @@ module Fog
raise Error, response.body['msgs'].first['INFO']
end
if response.status == 307 && params[:path] !~ %r{^/REST/Job/}
response = poll_job(response, params[:expects], @job_poll_timeout)
if params[:path] !~ %r{^/REST/Job/}
if response.status == 307
response = poll_job(response, params[:expects], @job_poll_timeout)
# Dynect intermittently returns 200 with an incomplete status. When this
# happens, the job should still be polled.
elsif response.status == 200 && response.body['status'].eql?('incomplete')
response.headers['Location'] = "/REST/Job/#{ response.body['job_id'] }"
response = poll_job(response, params[:expects], @job_poll_timeout)
end
end
response

View File

@ -1,3 +1,3 @@
module Fog
VERSION = '1.24.0'
VERSION = '1.24.1'
end