aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-12 09:02:53 +0100
committerChocobozzz <me@florianbigard.com>2021-11-12 09:02:53 +0100
commit3ef5909aecf5aa33c9f1235df81d4f8c5c8948f6 (patch)
treedd1e583d42c5c4ca00e51c66df6b75d789d6e7b2 /server/lib
parentcd2fad008a29d5a6b9ee5ea48e51388fa7fc12a0 (diff)
downloadPeerTube-3ef5909aecf5aa33c9f1235df81d4f8c5c8948f6.tar.gz
PeerTube-3ef5909aecf5aa33c9f1235df81d4f8c5c8948f6.tar.zst
PeerTube-3ef5909aecf5aa33c9f1235df81d4f8c5c8948f6.zip
Fix extendsLocalExpiration for redundancy
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/schedulers/videos-redundancy-scheduler.ts14
1 files changed, 3 insertions, 11 deletions
diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts
index 155d43343..16562ad0b 100644
--- a/server/lib/schedulers/videos-redundancy-scheduler.ts
+++ b/server/lib/schedulers/videos-redundancy-scheduler.ts
@@ -115,19 +115,11 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
115 for (const redundancyModel of expired) { 115 for (const redundancyModel of expired) {
116 try { 116 try {
117 const redundancyConfig = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.find(s => s.strategy === redundancyModel.strategy) 117 const redundancyConfig = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.find(s => s.strategy === redundancyModel.strategy)
118 const candidate: CandidateToDuplicate = { 118 const { totalUsed } = await VideoRedundancyModel.getStats(redundancyConfig.strategy)
119 redundancy: redundancyConfig,
120 video: null,
121 files: [],
122 streamingPlaylists: []
123 }
124 119
125 // If the administrator disabled the redundancy or decreased the cache size, remove this redundancy instead of extending it 120 // If the administrator disabled the redundancy or decreased the cache size, remove this redundancy instead of extending it
126 if (!redundancyConfig || await this.isTooHeavy(candidate)) { 121 if (!redundancyConfig || totalUsed > redundancyConfig.size) {
127 logger.info( 122 logger.info('Destroying redundancy %s because the cache size %s is too heavy.', redundancyModel.url, redundancyModel.strategy)
128 'Destroying redundancy %s because the cache size %s is too heavy.',
129 redundancyModel.url, redundancyModel.strategy, lTags(candidate.video.uuid)
130 )
131 123
132 await removeVideoRedundancy(redundancyModel) 124 await removeVideoRedundancy(redundancyModel)
133 } else { 125 } else {