mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
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
This commit is contained in:
@@ -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)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user