aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/schedulers/videos-redundancy-scheduler.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 16:21:09 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 16:21:30 +0200
commitf9f899b9f803eb5159a67781f10649a0cf040677 (patch)
tree2c02f33e38b0fdc9401fe5c98d7b148c967c68df /server/lib/schedulers/videos-redundancy-scheduler.ts
parentd9bdd007d7a1368d2a13127ecb5c0a81a18a8c04 (diff)
downloadPeerTube-f9f899b9f803eb5159a67781f10649a0cf040677.tar.gz
PeerTube-f9f899b9f803eb5159a67781f10649a0cf040677.tar.zst
PeerTube-f9f899b9f803eb5159a67781f10649a0cf040677.zip
Add redundancy check interval in config
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) {