diff --git a/lib/openwfe/expool/fs_expstorage.rb b/lib/openwfe/expool/fs_expstorage.rb index 2576ae86..5a418a19 100644 --- a/lib/openwfe/expool/fs_expstorage.rb +++ b/lib/openwfe/expool/fs_expstorage.rb @@ -70,7 +70,16 @@ def []= (fei, fexp) FileUtils.mkdir_p(d) unless File.exist?(d) - File.open("#{d}/#{fn}", 'wb') { |f| f.write(encode(fexp)) } + fn = File.join(d, fn) + + t = 0 + begin + File.open(fn, 'wb') { |f| f.write(encode(fexp)) } + rescue Exception => e + t += 1 + lerror("failed to write to #{fn}, because of #{e} (try #{t})") + retry unless t == 2 + end end # Retrieves an expression