diff --git a/TaskEngine/Tasks/DownloadPlaylistInfoTask.cs b/TaskEngine/Tasks/DownloadPlaylistInfoTask.cs index a85ae98..efc34f7 100644 --- a/TaskEngine/Tasks/DownloadPlaylistInfoTask.cs +++ b/TaskEngine/Tasks/DownloadPlaylistInfoTask.cs @@ -105,7 +105,7 @@ public async Task> GetKalturaPlaylist(Playlist playlist, int index, CTGrpc.JsonString jsonString = null; try { - GetLogger().LogError($"playlist=({playlist.Id}):GetKalturaChannelEntriesRPCAsync({playlist.PlaylistIdentifier}) - rpc starting"); + GetLogger().LogInformation($"playlist=({playlist.Id}):GetKalturaChannelEntriesRPCAsync({playlist.PlaylistIdentifier}) - rpc starting"); jsonString = await _rpcClient.PythonServerClient.GetKalturaChannelEntriesRPCAsync(new CTGrpc.PlaylistRequest { Url = playlist.PlaylistIdentifier @@ -123,7 +123,7 @@ public async Task> GetKalturaPlaylist(Playlist playlist, int index, } return newMedia; } finally { - GetLogger().LogError($"playlist=({playlist.Id}):GetKalturaChannelEntriesRPCAsync({playlist.PlaylistIdentifier}) - rpc complete"); + GetLogger().LogInformation($"playlist=({playlist.Id}):GetKalturaChannelEntriesRPCAsync({playlist.PlaylistIdentifier}) - rpc complete"); } JArray jArray = JArray.Parse(jsonString.Json); 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));