fix stuck playout builds (#235)

* fix stuck playout builds

* code cleanup
This commit is contained in:
Jason Dove
2021-05-31 06:38:54 -05:00
committed by GitHub
parent 539285d81e
commit 9f575dbd94
6 changed files with 53 additions and 2 deletions
+4 -2
View File
@@ -76,8 +76,10 @@ namespace ErsatzTV.Services
using IServiceScope scope = _serviceScopeFactory.CreateScope();
TvContext dbContext = scope.ServiceProvider.GetRequiredService<TvContext>();
List<int> playoutIds = await dbContext.Playouts.Map(p => p.Id).ToListAsync(cancellationToken);
foreach (int playoutId in playoutIds)
List<Playout> playouts = await dbContext.Playouts
.Include(p => p.Channel)
.ToListAsync(cancellationToken);
foreach (int playoutId in playouts.OrderBy(p => decimal.Parse(p.Channel.Number)).Map(p => p.Id))
{
await _workerChannel.WriteAsync(new BuildPlayout(playoutId), cancellationToken);
}