home: protect against cache accesses and expirations

This commit is contained in:
Carl Chenet 2017-05-18 18:54:28 +02:00
parent a823a31688
commit 830d0e6586

View file

@ -239,7 +239,12 @@ private
else
key = opts.merge(page: page).sort.map{|k,v| "#{k}=#{v.to_param}"
}.join(" ")
Rails.cache.fetch("stories #{key}", :expires_in => 45, &block)
begin
Rails.cache.fetch("stories #{key}", :expires_in => 45, &block)
rescue Errno::ENOENT => e
Rails.logger.error "error fetching stories #{key}: #{e}"
yield
end
end
end
end