From a5b10511bfa7696472b5fbb84a6d4956dc4c0bac Mon Sep 17 00:00:00 2001 From: Lawrence Angrave Date: Sun, 28 Jan 2024 17:29:45 -0600 Subject: [PATCH] Poll playlists upto 14 days after semester ends --- TaskEngine/Tasks/QueueAwakerTask.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/TaskEngine/Tasks/QueueAwakerTask.cs b/TaskEngine/Tasks/QueueAwakerTask.cs index 99cb4fc..ed1d722 100644 --- a/TaskEngine/Tasks/QueueAwakerTask.cs +++ b/TaskEngine/Tasks/QueueAwakerTask.cs @@ -280,9 +280,8 @@ private async Task DownloadAllPlaylists() { _downloadPlaylistInfoTask.PurgeQueue(); - var period = DateTime.Now.AddMonths(-6); - //TODO/TOREVIEW: Suggest Term.EndDate < Today plus 2 weeks (but let's check the semester dates in the DB and document this in the frontend) - playlists = await _context.Offerings.Where(o => o.Term.StartDate >= period).SelectMany(o => o.Playlists).Select(p => p.Id).ToListAsync(); + var cutOffDate = DateTimeOffset.Now.AddDays(14); + playlists = await _context.Offerings.Where(o => o.Term.EndDate < cutOffDate).SelectMany(o => o.Playlists).OrderByDescending(p => p.CreatedAt).Select(p => p.Id).ToListAsync(); } GetLogger().LogInformation($"DownloadAllPlaylists(); _downloadPlaylistInfoTask publishing {playlists.Count} tasks"); playlists.ForEach(p => _downloadPlaylistInfoTask.Publish(p));