Bladeren bron

modify renamemainOperation

yohei0125 4 jaren geleden
bovenliggende
commit
d43284867f
1 gewijzigde bestanden met toevoegingen van 7 en 17 verwijderingen
  1. 7 17
      packages/app/src/server/service/page.ts

+ 7 - 17
packages/app/src/server/service/page.ts

@@ -478,28 +478,13 @@ class PageService {
       logger.error('Failed to create PageOperation document.', err);
       throw err;
     }
-    const extendTimeSec = PageOperationAutoUpdateTimerType.ExtendSec;
-    const intervalSec = PageOperationAutoUpdateTimerType.IntervalSec;
 
-    const autoUpdateIntervalTimerId = await this.setIntervalUpdatePageOperationExpiryDate(pageOp._id, extendTimeSec, intervalSec);
-
-    let renamedPage;
-    try {
-      renamedPage = await this.renameMainOperation(page, newPagePath, user, options, pageOp._id, autoUpdateIntervalTimerId);
-      clearInterval(autoUpdateIntervalTimerId);
-      logger.info(`autoUpdateInterval(${autoUpdateIntervalTimerId}) is now cleared.`);
-    }
-    catch (err) {
-      clearInterval(autoUpdateIntervalTimerId);
-      logger.info(`autoUpdateInterval(${autoUpdateIntervalTimerId}) is now cleared.`);
-      logger.warn(`renameMainOperation Failed: ${err}`);
-      throw err;
-    }
+    const renamedPage = await this.renameMainOperation(page, newPagePath, user, options, pageOp._id);
 
     return renamedPage;
   }
 
-  async renameMainOperation(page, newPagePath: string, user, options, pageOpId: ObjectIdLike, autoUpdateIntervalTimerId: TSetInterval) {
+  async renameMainOperation(page, newPagePath: string, user, options, pageOpId: ObjectIdLike) {
     const Page = mongoose.model('Page') as unknown as PageModel;
 
     const updateMetadata = options.updateMetadata || false;
@@ -576,6 +561,11 @@ class PageService {
       throw Error('PageOperation document not found');
     }
 
+
+    const extendTimeSec = PageOperationAutoUpdateTimerType.ExtendSec;
+    const intervalSec = PageOperationAutoUpdateTimerType.IntervalSec;
+    const autoUpdateIntervalTimerId = await this.setIntervalUpdatePageOperationExpiryDate(pageOp._id, extendTimeSec, intervalSec);
+
     /*
      * Sub Operation
      */