home: protect against cache accesses and expirations
This commit is contained in:
parent
a823a31688
commit
830d0e6586
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue