Skip to content
Browse files

rescue for race condition in rails cache_page

  • Loading branch information...
1 parent d4ab16c commit 14fd6e04b57a433362bc0fa0b4df686c76b7e375 @yeah yeah committed Sep 25, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/page_cache_fu/patches.rb
View
5 lib/page_cache_fu/patches.rb
@@ -30,7 +30,10 @@ def cache_page_with_domain_and_query(content = nil, options = nil)
end
def cache_page_with_expiry(content = nil, options = nil)
- cache_page_without_expiry(content, options)
+ begin
+ cache_page_without_expiry(content, options)
+ rescue Errno::EEXIST # rescue error caused by race condition on filesystem, this should be done in Rails' ActionController::Caching::Pages::ClassMethods#cache_page
+ end
if self.class.page_cache_fu_options[params[:action].to_sym] and (expires_in = self.class.page_cache_fu_options[params[:action].to_sym][:expires_in])
expires_at = Time.now + expires_in
file = self.class.send(:page_cache_path, options)

0 comments on commit 14fd6e0

Please sign in to comment.
Something went wrong with that request. Please try again.