Skip to content

Commit

Permalink
Poll playlists upto 14 days after semester ends
Browse files Browse the repository at this point in the history
  • Loading branch information
angrave committed Jan 28, 2024
1 parent df6f54d commit a5b1051
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions TaskEngine/Tasks/QueueAwakerTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit a5b1051

Please sign in to comment.