aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers/videos-redundancy-scheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/schedulers/videos-redundancy-scheduler.ts')
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index 5f9fd9911..960651712 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -18,7 +18,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
18 private static instance: AbstractScheduler 18 private static instance: AbstractScheduler
19 private executing = false 19 private executing = false
20 20
21 protected schedulerIntervalMs = SCHEDULER_INTERVALS_MS.videosRedundancy 21 protected schedulerIntervalMs = CONFIG.REDUNDANCY.VIDEOS.CHECK_INTERVAL
22 22
23 private constructor () { 23 private constructor () {
24 super() 24 super()
@@ -50,6 +50,16 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
50 } 50 }
51 } 51 }
52 52
53 await this.removeExpired()
54
55 this.executing = false
56 }
57
58 static get Instance () {
59 return this.instance || (this.instance = new this())
60 }
61
62 private async removeExpired () {
53 const expired = await VideoRedundancyModel.listAllExpired() 63 const expired = await VideoRedundancyModel.listAllExpired()
54 64
55 for (const m of expired) { 65 for (const m of expired) {
@@ -61,12 +71,6 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
61 logger.error('Cannot remove %s video from our redundancy system.', this.buildEntryLogId(m)) 71 logger.error('Cannot remove %s video from our redundancy system.', this.buildEntryLogId(m))
62 } 72 }
63 } 73 }
64
65 this.executing = false
66 }
67
68 static get Instance () {
69 return this.instance || (this.instance = new this())
70 } 74 }
71 75
72 private findVideoToDuplicate (cache: VideosRedundancy) { 76 private findVideoToDuplicate (cache: VideosRedundancy) {