Fix extendsLocalExpiration for redundancy
This commit is contained in:
parent
cd2fad008a
commit
3ef5909aec
1 changed files with 3 additions and 11 deletions
|
@ -115,19 +115,11 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
|
||||||
for (const redundancyModel of expired) {
|
for (const redundancyModel of expired) {
|
||||||
try {
|
try {
|
||||||
const redundancyConfig = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.find(s => s.strategy === redundancyModel.strategy)
|
const redundancyConfig = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES.find(s => s.strategy === redundancyModel.strategy)
|
||||||
const candidate: CandidateToDuplicate = {
|
const { totalUsed } = await VideoRedundancyModel.getStats(redundancyConfig.strategy)
|
||||||
redundancy: redundancyConfig,
|
|
||||||
video: null,
|
|
||||||
files: [],
|
|
||||||
streamingPlaylists: []
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the administrator disabled the redundancy or decreased the cache size, remove this redundancy instead of extending it
|
// If the administrator disabled the redundancy or decreased the cache size, remove this redundancy instead of extending it
|
||||||
if (!redundancyConfig || await this.isTooHeavy(candidate)) {
|
if (!redundancyConfig || totalUsed > redundancyConfig.size) {
|
||||||
logger.info(
|
logger.info('Destroying redundancy %s because the cache size %s is too heavy.', redundancyModel.url, redundancyModel.strategy)
|
||||||
'Destroying redundancy %s because the cache size %s is too heavy.',
|
|
||||||
redundancyModel.url, redundancyModel.strategy, lTags(candidate.video.uuid)
|
|
||||||
)
|
|
||||||
|
|
||||||
await removeVideoRedundancy(redundancyModel)
|
await removeVideoRedundancy(redundancyModel)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue