From bd2c3a4a8010cde7c5e8a4a61d1d588476a5d684 Mon Sep 17 00:00:00 2001 From: defnotken Date: Thu, 18 Sep 2025 22:03:40 -0500 Subject: [PATCH] add cache logging to 1.11.13 --- LightlessSync/FileCache/FileCacheManager.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/LightlessSync/FileCache/FileCacheManager.cs b/LightlessSync/FileCache/FileCacheManager.cs index 51487f6..17f22de 100644 --- a/LightlessSync/FileCache/FileCacheManager.cs +++ b/LightlessSync/FileCache/FileCacheManager.cs @@ -260,6 +260,7 @@ public sealed class FileCacheManager : IHostedService { if (_fileCaches.TryGetValue(hash, out var caches)) { + _logger.LogTrace("Removing from DB: {hash} => {path}", hash, prefixedFilePath); var removedCount = caches?.RemoveAll(c => string.Equals(c.PrefixedFilePath, prefixedFilePath, StringComparison.Ordinal)); _logger.LogTrace("Removed from DB: {count} file(s) with hash {hash} and file cache {path}", removedCount, hash, prefixedFilePath); @@ -404,6 +405,12 @@ public sealed class FileCacheManager : IHostedService private FileCacheEntity? Validate(FileCacheEntity fileCache) { + if (string.IsNullOrWhiteSpace(fileCache.ResolvedFilepath)) + { + _logger.LogWarning("FileCacheEntity has empty ResolvedFilepath for hash {hash}, prefixed path {prefixed}", fileCache.Hash, fileCache.PrefixedFilePath); + RemoveHashedFile(fileCache.Hash, fileCache.PrefixedFilePath); + return null; + } var file = new FileInfo(fileCache.ResolvedFilepath); if (!file.Exists) {