-
-
Save scottwb/1161210 to your computer and use it in GitHub Desktop.
module CarrierWave | |
module Storage | |
class Fog | |
class File | |
alias :store_without_safety_net :store | |
def store(new_file) | |
retries_remaining = 3 | |
begin | |
store_without_safety_net(new_file) | |
rescue Excon::Errors::SocketError => e | |
if e.inspect =~ /Connection reset by peer/ | |
retries_remaining -= 1 | |
if retries_remaining <= 0 | |
raise | |
else | |
retry | |
end | |
else | |
raise | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
You know, I never really dug into it. I've been running in production with this hack for a few months and it's totally out-of-sight-out-of-mind now. As far as I know, the problem still exists and the hack above is happily taking care of it for me.
Glad it's not just me seeing this. I thought maybe I was going crazy.
@charlietran I just added a new gist that contains the full version of this patch that I am now using in production. The only real difference since the original is that I added this protection to a couple additional methods. You can see the new gist here: https://gist.github.com/1822442
Hey guys, sorry about the trouble you were having there. I just patched fog to do retries itself on put_object by adding :idempotent => true
to the request for put_object, see:
fog/fog@a1fe973
After the next release (hopefully this week), your issue should hopefully be resolved and no longer require this monkey patch. There may be other things that should be marked as retry-able as well, so let me know (or send me a patch) if you run into any other ones. Thanks!
thanks so much for this, saved me at crunch time as well! ever discover more about this issue?