Skip to content

Commit

Permalink
Fix Dynect job poll bug.
Browse files Browse the repository at this point in the history
        Dynect sometimes gives back HTTP 200 instead of 307.
        Netflix/denominator#261

        We need a workaround for this until it is fixed.
  • Loading branch information
Chris Chalstrom committed Nov 13, 2014
1 parent 29092cf commit 60a4bc0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/fog/dynect/dns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,16 @@ def request(params)
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
Expand Down

0 comments on commit 60a4bc0

Please sign in to comment.