lib/defog/proxy.rb in defog-0.9.0 vs lib/defog/proxy.rb in defog-0.9.1

- old
+ new

@@ -191,11 +191,19 @@ return if want_size.nil? return if want_size <= 0 # find available space (not counting current proxy) available = max_cache_size - proxy_root.find { |path| available -= path.size if path.file? and path != proxy_path} + proxy_root.find { |path| + available -= begin + path.size + rescue Errno::ENOENT + # some other process has snuck in and deleted the + # file since the path.file? check. has happened... + 0 + end if path.file? and path != proxy_path + } return if available >= want_size space_needed = want_size - available # find all paths in the cache that aren't currently open (not @@ -224,10 +232,10 @@ # free the remaining candidates candidates.each do |candidate| begin candidate.unlink rescue Errno::ENOENT - # some other process has deleted the while we were looking at it. + # some other process has deleted the file while we were looking at it. # nothing to do. end end end