Browse Source

fix double scheduling (#435)

pull/436/head
Jason Dove 4 years ago committed by GitHub
parent
commit
69354c9296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 9
      ErsatzTV.Core/Scheduling/PlayoutBuilder.cs

2
CHANGELOG.md

@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fix double scheduling; this could happen if the app was shutdown during a playout build
## [0.1.4-alpha] - 2021-10-14
### Fixed

9
ErsatzTV.Core/Scheduling/PlayoutBuilder.cs

@ -215,6 +215,15 @@ namespace ErsatzTV.Core.Scheduling @@ -215,6 +215,15 @@ namespace ErsatzTV.Core.Scheduling
playout.Channel.Number,
playout.Channel.Name,
currentTime);
// removing any items scheduled past the start anchor
// this could happen if the app was closed after scheduling items
// but before saving the anchor
int removed = playout.Items.RemoveAll(pi => pi.StartOffset >= currentTime);
if (removed > 0)
{
_logger.LogWarning("Removed {Count} schedule items beyond current start anchor", removed);
}
// start with the previously-decided schedule item
int index = sortedScheduleItems.IndexOf(startAnchor.NextScheduleItem);

Loading…
Cancel
Save