aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r--actionview/lib/action_view/cache_expiry.rb19
-rw-r--r--actionview/lib/action_view/helpers/number_helper.rb2
2 files changed, 12 insertions, 9 deletions
diff --git a/actionview/lib/action_view/cache_expiry.rb b/actionview/lib/action_view/cache_expiry.rb
index 820afc093d..3d8ffeaefb 100644
--- a/actionview/lib/action_view/cache_expiry.rb
+++ b/actionview/lib/action_view/cache_expiry.rb
@@ -16,18 +16,21 @@ module ActionView
@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
diff --git a/actionview/lib/action_view/helpers/number_helper.rb b/actionview/lib/action_view/helpers/number_helper.rb
index 35206b7e48..03ec7df9c1 100644
--- a/actionview/lib/action_view/helpers/number_helper.rb
+++ b/actionview/lib/action_view/helpers/number_helper.rb
@@ -251,7 +251,7 @@ module ActionView
end
# Formats the bytes in +number+ into a more understandable
- # representation (e.g., giving it 1500 yields 1.5 KB). This
+ # representation (e.g., giving it 1500 yields 1.46 KB). This
# method is useful for reporting file sizes to users. You can
# customize the format in the +options+ hash.
#