瀏覽代碼

export json sequencially

Yuki Takei 5 年之前
父節點
當前提交
aa86b11468
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/server/service/export.js

+ 6 - 2
src/server/service/export.js

@@ -205,8 +205,12 @@ class ExportService {
   async exportCollectionsToZippedJson(collections) {
     const metaJson = await this.createMetaJson();
 
-    const promises = collections.map(collectionName => this.exportCollectionToJson(collectionName));
-    const jsonFiles = await Promise.all(promises);
+    // sequencial read
+    const jsonFiles = [];
+    const jsonFilesPromises = collections.map(collectionName => this.exportCollectionToJson(collectionName));
+    for await (const jsonFile of jsonFilesPromises) {
+      jsonFiles.push(jsonFile);
+    }
 
     // send terminate event
     this.emitStartZippingEvent();