Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add object to timeline to trigger a regeneration at point in time #1384

Open
wants to merge 1 commit into
base: release53
Choose a base branch
from

Conversation

Julusian
Copy link
Contributor

About the Contributor

This pull request is posted on behalf of the BBC

Type of Contribution

This is a: Feature

New Behavior

This is a half-feature, that doesn't make much sense on its own, but is a pretty isolated chunk of a larger feature.

This half-feature allows the timeline/playout-gateway to trigger a callback to regenerate the timeline. This is done with the same callback flow as we use for partinstances/pieceinstances, which has been expanded to use a new trigger type.

It uses a token which changes upon each generation of the timeline to minimise the risk of getting stuck in a regeneration loop where sofie and playout-gateway disagree about the current state/timeline.

The timeline generation logic does not currently create this object, but the flow is in place for it to define a regenerateTimelineAt value, which will cause the object to be created and timeline to be regenerated at that point in time. You can see this in action by forcing that value in the code to something like getCurrentTime() + 10000, and observe the timeline be regenerated every 10s.

Our intention with this is to allow us to avoid putting certain pieces on the timeline until close to the time they are played, rather than them being on the timeline for the around an hour before they get played. By avoiding putting them on the timeline, we avoid these pieces taking part in AB resolving and lookahead.

Originally I was considering doing this by keeping some timer inside the job-worker to run the regeneration, but thought this better matched how things currently work. It would have been fine and not too messy to do inside the job-worker though.

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

Time Frame

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@Julusian Julusian requested a review from a team as a code owner February 12, 2025 14:03
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 78.57143% with 24 lines in your changes missing coverage. Please review.

Please upload report for BASE (release53@955d96e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ckages/job-worker/src/playout/timeline/generate.ts 61.29% 24 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             release53    #1384   +/-   ##
============================================
  Coverage             ?   56.28%           
============================================
  Files                ?      408           
  Lines                ?    73196           
  Branches             ?     4203           
============================================
  Hits                 ?    41196           
  Misses               ?    31874           
  Partials             ?      126           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nytamin nytamin added Contribution External contribution Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution from BBC Contributions sponsored by BBC (bbc.co.uk) Contribution External contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants