tasks/updater/network.rb in bootstrap-4.0.0.alpha3 vs tasks/updater/network.rb in bootstrap-4.0.0.alpha3.1
- old
+ new
@@ -1,10 +1,12 @@
require 'shellwords'
class Updater
module Network
protected
+ WRITE_FILES_MUTEX = Mutex.new
+
def get_paths_by_type(dir, file_re, recursive = true)
get_file_paths(dir, recursive).select { |path| path =~ file_re }
end
def get_file_paths(dir, recursive = true)
@@ -22,10 +24,10 @@
files -= contents.keys
log_http_get_files files, path_url, false
files.map do |name|
Thread.start {
contents[name] = open("#{path_url}/#{name}").read
- Thread.exclusive { write_cached_files path, name => contents[name] }
+ WRITE_FILES_MUTEX.synchronize { write_cached_files path, name => contents[name] }
}
end.each(&:join)
contents
end