فهرست منبع

use arrow function for callback to bind 'this' to pageBulkExportService

Futa Arai 1 سال پیش
والد
کامیت
6852fffea8
1فایلهای تغییر یافته به همراه10 افزوده شده و 6 حذف شده
  1. 10 6
      apps/app/src/features/page-bulk-export/server/service/page-bulk-export-job-cron.ts

+ 10 - 6
apps/app/src/features/page-bulk-export/server/service/page-bulk-export-job-cron.ts

@@ -47,9 +47,11 @@ class PageBulkExportJobCronService extends CronService {
       createdAt: { $lt: new Date(Date.now() - exportJobExpirationSeconds * 1000) },
     });
 
-    if (pageBulkExportService != null) {
-      await this.cleanUpAndDeleteBulkExportJobs(expiredExportJobs, pageBulkExportService?.cleanUpExportJobResources);
-    }
+    await this.cleanUpAndDeleteBulkExportJobs(expiredExportJobs, async(job) => {
+      if (pageBulkExportService != null) {
+        pageBulkExportService.cleanUpExportJobResources(job);
+      }
+    });
   }
 
   /**
@@ -86,9 +88,11 @@ class PageBulkExportJobCronService extends CronService {
   async deleteFailedExportJobs() {
     const failedExportJobs = await PageBulkExportJob.find({ status: PageBulkExportJobStatus.failed });
 
-    if (pageBulkExportService != null) {
-      await this.cleanUpAndDeleteBulkExportJobs(failedExportJobs, pageBulkExportService.cleanUpExportJobResources);
-    }
+    await this.cleanUpAndDeleteBulkExportJobs(failedExportJobs, async(job) => {
+      if (pageBulkExportService != null) {
+        pageBulkExportService.cleanUpExportJobResources(job);
+      }
+    });
   }
 
   async cleanUpAndDeleteBulkExportJobs(