From d9b301023acd58a0fdc068676758264f725ae22d Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 13 Mar 2018 13:30:06 +0000 Subject: [PATCH] Use eachSeries rather than a job array --- .../Features/Uploads/FileSystemImportManager.coffee | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/Uploads/FileSystemImportManager.coffee b/services/web/app/coffee/Features/Uploads/FileSystemImportManager.coffee index 6f64c11a18..856408cc64 100644 --- a/services/web/app/coffee/Features/Uploads/FileSystemImportManager.coffee +++ b/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.series jobs, callback + callback + ) addEntity: (user_id, project_id, folder_id, name, path, replace, callback = (error, entity)-> ) -> FileSystemImportManager._isSafeOnFileSystem path, (err, isSafe)->