1
0
Fork 0

Fix extendsLocalExpiration for redundancy

This commit is contained in:
Chocobozzz 2021-11-12 09:02:53 +01:00
parent cd2fad008a
commit 3ef5909aec
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -115,19 +115,11 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
for (const redundancyModel of expired) {
try {
const redundancyConfig = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.find(s => s.strategy === redundancyModel.strategy)
const candidate: CandidateToDuplicate = {
redundancy: redundancyConfig,
video: null,
files: [],
streamingPlaylists: []
}
const { totalUsed } = await VideoRedundancyModel.getStats(redundancyConfig.strategy)
// If the administrator disabled the redundancy or decreased the cache size, remove this redundancy instead of extending it
if (!redundancyConfig || await this.isTooHeavy(candidate)) {
logger.info(
'Destroying redundancy %s because the cache size %s is too heavy.',
redundancyModel.url, redundancyModel.strategy, lTags(candidate.video.uuid)
)
if (!redundancyConfig || totalUsed > redundancyConfig.size) {
logger.info('Destroying redundancy %s because the cache size %s is too heavy.', redundancyModel.url, redundancyModel.strategy)
await removeVideoRedundancy(redundancyModel)
} else {