reduce overlapping runs

This commit is contained in:
2026-02-02 13:05:36 -05:00
parent 6eaeee9a67
commit 2315d6ab9f

View File

@@ -55,8 +55,12 @@ public class SpotifyTrackMatchingService : BackgroundService
_logger.LogError(ex, "Error during startup track matching"); _logger.LogError(ex, "Error during startup track matching");
} }
// Now start the periodic matching loop
while (!stoppingToken.IsCancellationRequested) while (!stoppingToken.IsCancellationRequested)
{ {
// Wait 30 minutes before next run
await Task.Delay(TimeSpan.FromMinutes(30), stoppingToken);
try try
{ {
await MatchAllPlaylistsAsync(stoppingToken); await MatchAllPlaylistsAsync(stoppingToken);
@@ -65,9 +69,6 @@ public class SpotifyTrackMatchingService : BackgroundService
{ {
_logger.LogError(ex, "Error in track matching service"); _logger.LogError(ex, "Error in track matching service");
} }
// Run every 30 minutes to catch new missing tracks
await Task.Delay(TimeSpan.FromMinutes(30), stoppingToken);
} }
} }