From eb46692b25651ad94a7544c0c456e989234b0348 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Sun, 1 Feb 2026 11:33:42 -0500 Subject: [PATCH] Extend backward search window to 24 hours for Spotify missing tracks - Search forward 12 hours from sync time - Search backward 24 hours from sync time (was 12 hours) - Ensures yesterday's file is always found when running at 11 AM after 4 PM sync - Sync runs daily at 4:15 PM, so 24h backward always catches previous day's file --- .../Services/Spotify/SpotifyMissingTracksFetcher.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs b/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs index d3775ff..036dc31 100644 --- a/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs +++ b/allstarr/Services/Spotify/SpotifyMissingTracksFetcher.cs @@ -337,12 +337,12 @@ public class SpotifyMissingTracksFetcher : BackgroundService // If we haven't reached today's sync time yet, start from yesterday's sync time var syncTime = now >= todaySync ? todaySync : todaySync.AddDays(-1); - _logger.LogInformation(" Searching ±12 hours around {SyncTime}", syncTime); + _logger.LogInformation(" Searching +12h forward, -24h backward from {SyncTime}", syncTime); var found = false; // Search forward 12 hours from sync time - _logger.LogInformation(" Phase 1: Searching forward from sync time..."); + _logger.LogInformation(" Phase 1: Searching forward 12 hours from sync time..."); for (var minutesAhead = 0; minutesAhead <= 720; minutesAhead++) // 720 minutes = 12 hours { if (cancellationToken.IsCancellationRequested) break; @@ -361,11 +361,11 @@ public class SpotifyMissingTracksFetcher : BackgroundService } } - // Then search backwards 12 hours from sync time + // Then search backwards 24 hours from sync time to catch yesterday's file if (!found) { - _logger.LogInformation(" Phase 2: Searching backward from sync time..."); - for (var minutesBehind = 1; minutesBehind <= 720; minutesBehind++) + _logger.LogInformation(" Phase 2: Searching backward 24 hours from sync time..."); + for (var minutesBehind = 1; minutesBehind <= 1440; minutesBehind++) // 1440 minutes = 24 hours { if (cancellationToken.IsCancellationRequested) break; @@ -386,7 +386,7 @@ public class SpotifyMissingTracksFetcher : BackgroundService if (!found) { - _logger.LogWarning(" ✗ Could not find missing tracks file in ±12 hour window"); + _logger.LogWarning(" ✗ Could not find missing tracks file (searched +12h/-24h window)"); } }