From b7e440e992759e93c6a139430635aef910054379 Mon Sep 17 00:00:00 2001 From: ts-3156 Date: Thu, 15 Aug 2019 16:25:01 +0900 Subject: [PATCH] Ignore Errno::ENOTEMPTY when calling AS::Cache::FileStore#clear with race conditions Currently `Rails.cache.clear` raises Errno::ENOTEMPTY on highly accessed server. The error just can be ignored. --- activesupport/lib/active_support/cache/file_store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb index 925440a23f780..65969f3aaac8c 100644 --- a/activesupport/lib/active_support/cache/file_store.rb +++ b/activesupport/lib/active_support/cache/file_store.rb @@ -36,7 +36,7 @@ def self.supports_cache_versioning? def clear(options = nil) root_dirs = (Dir.children(cache_path) - GITKEEP_FILES) FileUtils.rm_r(root_dirs.collect { |f| File.join(cache_path, f) }) - rescue Errno::ENOENT + rescue Errno::ENOENT, Errno::ENOTEMPTY end # Preemptively iterates through all stored keys and removes the ones which have expired.