diff options
Diffstat (limited to 'server/lib/schedulers')
-rw-r--r-- | server/lib/schedulers/videos-redundancy-scheduler.ts | 14 |
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 { |