storage: done events must be called next tick
It seems that listDir() returns synchronously (!), not sure how. This results in the done event getting called with an error but the EE event handlers are not setup yet.
This commit is contained in:
+2
-2
@@ -167,7 +167,7 @@ function copy(apiConfig, oldFilePath, newFilePath) {
|
||||
async.eachLimit(entries, concurrency, copyFile, done);
|
||||
}, function (error) {
|
||||
events.emit('progress', `Copied ${total} files`);
|
||||
events.emit('done', error);
|
||||
process.nextTick(() => events.emit('done', error));
|
||||
});
|
||||
|
||||
return events;
|
||||
@@ -207,7 +207,7 @@ function removeDir(apiConfig, pathPrefix) {
|
||||
}, function (error) {
|
||||
events.emit('progress', `Deleted ${total} files`);
|
||||
|
||||
events.emit('done', error);
|
||||
process.nextTick(() => events.emit('done', error));
|
||||
});
|
||||
|
||||
return events;
|
||||
|
||||
Reference in New Issue
Block a user