]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/schedulers/remove-old-jobs-scheduler.ts
Fix transaction when processing local viewer
[github/Chocobozzz/PeerTube.git] / server / lib / schedulers / remove-old-jobs-scheduler.ts
index add5677ac03442e629607220714b5c2c71b89d8b..dffef3542ec35542353b4652956540a47333303f 100644 (file)
@@ -1,16 +1,23 @@
+import { isTestInstance } from '../../helpers/core-utils'
+import { logger } from '../../helpers/logger'
 import { JobQueue } from '../job-queue'
 import { AbstractScheduler } from './abstract-scheduler'
+import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
 
 export class RemoveOldJobsScheduler extends AbstractScheduler {
 
   private static instance: AbstractScheduler
 
+  protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.REMOVE_OLD_JOBS
+
   private constructor () {
     super()
   }
 
-  async execute () {
-    JobQueue.Instance.removeOldJobs()
+  protected internalExecute () {
+    if (!isTestInstance()) logger.info('Removing old jobs in scheduler.')
+
+    return JobQueue.Instance.removeOldJobs()
   }
 
   static get Instance () {