fix automatic playout reset (#999)

This commit is contained in:
Jason Dove
2022-10-16 10:30:54 -05:00
committed by GitHub
parent f2bc884632
commit 485a874ab5
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -138,8 +138,10 @@ public class SchedulerService : BackgroundService
foreach (Playout playout in playouts.OrderBy(p => decimal.Parse(p.Channel.Number)))
{
if (DateTime.Now.Subtract(DateTime.Today.Add(playout.DailyRebuildTime ?? TimeSpan.FromDays(7))) <
TimeSpan.FromMinutes(5))
DateTime now = DateTime.Now;
DateTime target = DateTime.Today.Add(playout.DailyRebuildTime ?? TimeSpan.FromDays(7));
// check absolute diff
if (now.Subtract(target).Duration() < TimeSpan.FromMinutes(5))
{
await _workerChannel.WriteAsync(
new BuildPlayout(playout.Id, PlayoutBuildMode.Reset),