未验证 提交 4685fa92 编写于 作者: R Rafael França 提交者: Rafael Mendonça França

Merge pull request #36323 from jhawthorn/cache_expiry_mutex

Wrap ActionView cache expiry in a mutex
上级 551e837d
......@@ -16,18 +16,21 @@ def initialize(watcher:)
@watched_dirs = nil
@watcher_class = watcher
@watcher = nil
@mutex = Mutex.new
end
def clear_cache_if_necessary
watched_dirs = dirs_to_watch
if watched_dirs != @watched_dirs
@watched_dirs = watched_dirs
@watcher = @watcher_class.new([], watched_dirs) do
clear_cache
@mutex.synchronize do
watched_dirs = dirs_to_watch
if watched_dirs != @watched_dirs
@watched_dirs = watched_dirs
@watcher = @watcher_class.new([], watched_dirs) do
clear_cache
end
@watcher.execute
else
@watcher.execute_if_updated
end
@watcher.execute
else
@watcher.execute_if_updated
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册