فهرست منبع

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

Add files to project in series to avoid lock contention
James Allen 8 سال پیش
والد
کامیت
de94e33b5d
1فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 5 3
      services/web/app/coffee/Features/Uploads/FileSystemImportManager.coffee

+ 5 - 3
services/web/app/coffee/Features/Uploads/FileSystemImportManager.coffee

@@ -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)->