Fix: Exclude active cache folders in GetCachedFrameAsync to prevent reading incomplete data

- Add active cache folder exclusion to GetCachedFrameAsync
- Prevents TaskCanceledException when reading metadata from folders being written to
- Matches pattern used in GetCachedRadarAsync for consistency
This commit is contained in:
2025-12-16 01:57:02 +10:00
parent e5aee5be82
commit ee5bffde88
4 changed files with 92 additions and 1 deletions
+4 -1
View File
@@ -116,7 +116,10 @@ public class CacheService : ICacheService
return null;
}
var (cacheFolderPath, _) = await GetCachedScreenshotWithMetadataAsync(suburb, state, CachedDataType.Radar, null, cancellationToken);
// Exclude active cache folder (currently being written to) to avoid reading incomplete data
var locationKey = LocationHelper.GetLocationKey(suburb, state);
var excludeFolder = GetActiveCacheFolder(locationKey);
var (cacheFolderPath, _) = await GetCachedScreenshotWithMetadataAsync(suburb, state, CachedDataType.Radar, excludeFolder, cancellationToken);
if (string.IsNullOrEmpty(cacheFolderPath))
{