Merge pull request #397 from sharelatex/ja-fix-project-upload

Add files to project in series to avoid lock contention
This commit is contained in:
James Allen 2018-03-13 13:33:16 +00:00 committed by GitHub
commit de94e33b5d

View file

@ -49,15 +49,17 @@ module.exports = FileSystemImportManager =
return callback("path is symlink")
fs.readdir folderPath, (error, entries = []) =>
return callback(error) if error?
jobs = _.map entries, (entry) =>
(callback) =>
async.eachSeries(
entries,
(entry, callback) =>
FileTypeManager.shouldIgnore entry, (error, ignore) =>
return callback(error) if error?
if !ignore
FileSystemImportManager.addEntity user_id, project_id, parent_folder_id, entry, "#{folderPath}/#{entry}", replace, callback
else
callback()
async.parallelLimit jobs, 5, callback
callback
)
addEntity: (user_id, project_id, folder_id, name, path, replace, callback = (error, entity)-> ) ->
FileSystemImportManager._isSafeOnFileSystem path, (err, isSafe)->