mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-10 07:58:39 -05:00
feat: implement per-playlist cron scheduling with persistent cache
- Added Cronos package for cron expression parsing - Each playlist now has independent cron schedule (default: 0 8 * * 1) - Cache persists until next cron run, not just cache duration - Prevents excess Spotify API calls - only refreshes on cron trigger - Manual refresh still allowed with 5-minute cooldown - Added 429 rate limit handling for user playlist fetching - Added crontab.guru link to UI for easy schedule building - Both SpotifyPlaylistFetcher and SpotifyTrackMatchingService use cron - Automatic matching only runs when cron schedule triggers
This commit is contained in:
@@ -1966,6 +1966,12 @@ public class AdminController : ControllerBase
|
||||
var response = await _jellyfinHttpClient.SendAsync(request);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.TooManyRequests)
|
||||
{
|
||||
_logger.LogWarning("Spotify rate limit hit (429) when fetching playlists");
|
||||
return StatusCode(429, new { error = "Spotify rate limit exceeded. Please wait a moment and try again." });
|
||||
}
|
||||
|
||||
_logger.LogWarning("Failed to fetch Spotify playlists: {StatusCode}", response.StatusCode);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user