Yuki Takei 5 лет назад
Родитель
Сommit
1b3108b917
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      src/server/service/import.js

+ 6 - 4
src/server/service/import.js

@@ -164,12 +164,14 @@ class ImportService {
     // init status object
     // init status object
     this.currentProgressingStatus = new CollectionProgressingStatus(collections);
     this.currentProgressingStatus = new CollectionProgressingStatus(collections);
 
 
-    try {
+    // sequencial import
     const promises = collections.map((collectionName) => {
     const promises = collections.map((collectionName) => {
       const importSettings = importSettingsMap[collectionName];
       const importSettings = importSettingsMap[collectionName];
       return this.importCollection(collectionName, importSettings);
       return this.importCollection(collectionName, importSettings);
     });
     });
-      await Promise.all(promises);
+    for await (const promise of promises) {
+      try {
+        await promise;
       }
       }
       // catch ImportingCollectionError
       // catch ImportingCollectionError
       catch (err) {
       catch (err) {
@@ -177,11 +179,11 @@ class ImportService {
         logger.error(`failed to import to ${collectionProgress.collectionName}`, err);
         logger.error(`failed to import to ${collectionProgress.collectionName}`, err);
         this.emitProgressEvent(collectionProgress, { message: err.message });
         this.emitProgressEvent(collectionProgress, { message: err.message });
       }
       }
-    finally {
+    }
+
     this.currentProgressingStatus = null;
     this.currentProgressingStatus = null;
     this.emitTerminateEvent();
     this.emitTerminateEvent();
   }
   }
-  }
 
 
   /**
   /**
    * import a collection from json
    * import a collection from json