mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Make FileStore use atomic writes
This commit is contained in:
@@ -15,7 +15,7 @@ module ActiveSupport
|
||||
def write(name, value, options = nil)
|
||||
super
|
||||
ensure_cache_path(File.dirname(real_file_path(name)))
|
||||
File.open(real_file_path(name), "wb+") { |f| f.write(value) }
|
||||
File.atomic_write(real_file_path(name)) { |f| f.write(value) }
|
||||
rescue => e
|
||||
RAILS_DEFAULT_LOGGER.error "Couldn't create cache directory: #{name} (#{e.message})" if RAILS_DEFAULT_LOGGER
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user