Fix bug in redundancy eviction
authorChocobozzz <me@florianbigard.com>
Wed, 4 Sep 2019 12:40:29 +0000 (14:40 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 4 Sep 2019 12:40:39 +0000 (14:40 +0200)
server/lib/schedulers/videos-redundancy-scheduler.ts

index cd70fd85161273cdb3acbada1022d79e643e9831..5f4aad66e914bf40aac591fd1d5950a9b5d35f55 100644 (file)
@@ -241,7 +241,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler {
   }
 
   private async purgeCacheIfNeeded (candidateToDuplicate: CandidateToDuplicate) {
-    while (this.isTooHeavy(candidateToDuplicate)) {
+    while (await this.isTooHeavy(candidateToDuplicate)) {
       const redundancy = candidateToDuplicate.redundancy
       const toDelete = await VideoRedundancyModel.loadOldestLocalThatAlreadyExpired(redundancy.strategy, redundancy.minLifetime)
       if (!toDelete) return