basic block duration enforcement (#1556)

This commit is contained in:
Jason Dove
2024-01-15 06:26:14 -06:00
committed by GitHub
parent c409fd8b47
commit 2ce8db9e01
2 changed files with 33 additions and 7 deletions
@@ -56,14 +56,29 @@ public class BlockPlayoutBuilder(
BlockPlayoutChangeDetection.RemoveItemAndHistory(playout, playoutItem);
}
DateTimeOffset currentTime = start;
foreach (EffectiveBlock effectiveBlock in updatedEffectiveBlocks)
{
logger.LogDebug(
"Will schedule block {Block} at {Start}",
effectiveBlock.Block.Name,
effectiveBlock.Start);
if (currentTime < effectiveBlock.Start)
{
currentTime = effectiveBlock.Start;
DateTimeOffset currentTime = effectiveBlock.Start;
logger.LogDebug(
"Will schedule block {Block} at {Start}",
effectiveBlock.Block.Name,
effectiveBlock.Start);
}
else
{
logger.LogDebug(
"Will schedule block {Block} with start {Start} at {ActualStart}",
effectiveBlock.Block.Name,
effectiveBlock.Start,
currentTime);
}
DateTimeOffset blockFinish = effectiveBlock.Start.AddMinutes(effectiveBlock.Block.Minutes);
foreach (BlockItem blockItem in effectiveBlock.Block.Items.OrderBy(i => i.Index))
{
@@ -73,6 +88,17 @@ public class BlockPlayoutBuilder(
continue;
}
if (currentTime >= blockFinish)
{
logger.LogDebug(
"Current time {Time} for block {Block} is beyond block finish {Finish}; will stop with this block's items",
currentTime,
effectiveBlock.Block.Name,
blockFinish);
break;
}
// check for playout history for this collection
string historyKey = HistoryDetails.KeyForBlockItem(blockItem);
//logger.LogDebug("History key for block item {Item} is {Key}", blockItem.Id, historyKey);