lib/defog/proxy.rb in defog-0.9.2 vs lib/defog/proxy.rb in defog-0.9.3
- old
+ new
@@ -205,10 +205,10 @@
candidates = []
proxy_root.find { |path| candidates << path if path.file? and not @reserved_proxy_paths.include?(path) and path != proxy_path}
# take candidates in LRU order until that would be enough space
would_free = 0
- candidates = Set.new(candidates.sort_by(&:atime).take_while{|path| (would_free < space_needed).tap{|condition| would_free += pathTry(path, :size)}})
+ candidates = Set.new(candidates.sort_by{|path| pathTry(path, :atime)}.take_while{|path| (would_free < space_needed).tap{|condition| would_free += pathTry(path, :size)}})
# still not enough...?
raise Error::CacheFull, "No room in cache for #{proxy_path.relative_path_from(proxy_root)}: size=#{want_size} available=#{available} can_free=#{would_free} (max_cache_size=#{max_cache_size})" if would_free < space_needed
# LRU order may have taken more than needed, if last file was a big