|
@@ -53,8 +53,19 @@ class DiskLRUService {
|
|
if (size >= maxSize) {
|
|
if (size >= maxSize) {
|
|
const leastRecentlyUsed =
|
|
const leastRecentlyUsed =
|
|
await this.findLeastRecentlyUsed(cacheDir);
|
|
await this.findLeastRecentlyUsed(cacheDir);
|
|
-
|
|
|
|
- await unlink(leastRecentlyUsed.path);
|
|
|
|
|
|
+ try {
|
|
|
|
+ await unlink(leastRecentlyUsed.path);
|
|
|
|
+ } catch (e) {
|
|
|
|
+ // ENOENT: File not found
|
|
|
|
+ // which can be ignored as we are trying to delete the file anyway
|
|
|
|
+ if (e.code !== 'ENOENT') {
|
|
|
|
+ logError(
|
|
|
|
+ e,
|
|
|
|
+ 'Failed to evict least recently used'
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ // ignoring the error, as it would get retried on the next run
|
|
|
|
+ }
|
|
this.evictLeastRecentlyUsed(cacheDir, maxSize);
|
|
this.evictLeastRecentlyUsed(cacheDir, maxSize);
|
|
}
|
|
}
|
|
resolve(null);
|
|
resolve(null);
|