Skip to content

Commit

Permalink
added a retry (and lerror) to FsStorage#[]=
Browse files Browse the repository at this point in the history
  • Loading branch information
jmettraux committed Sep 9, 2009
1 parent b76e754 commit c47f1e5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/openwfe/expool/fs_expstorage.rb
Expand Up @@ -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
Expand Down

0 comments on commit c47f1e5

Please sign in to comment.