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

wip: rework piece expected packages SOFIE-3402 #1258

Draft
wants to merge 22 commits into
base: release52
Choose a base branch
from

Conversation

Julusian
Copy link
Member

This is a very incomplete draft of how this could work.

The aim was to make a couple of key changes:

Simplify the expectedPackages property on pieces/adlibs/whatever, to only include a couple of ids to reference the mongo document

This has some complications, because we then need to load documents from the collection at certain points that we didn't before. Primarily this made things complicated during playout, as we need to make a copy of any packages belonging to pieces when converting to pieceinstances, so that we can be sure the package won't disappear while still on air.

Rework the ExpectedPackages collection to avoid duplicates

Today, if piece A has a package for a clip called 'test', and piece B has the same package, this will result in two mongo documents, no matter what parts these pieces are in. This means two statuses from package-manager too.

With this change, that should become one document (per rundown). The intention is that multiple pieces can reference the same document, and we use an id derived from the content and rundownId.

Then for playout we don't need to make a copy, but just mark the document as also 'belonging' to a pieceInstance. In general this should mean that playout can skip loading the full versions of these documents, and instead only load a portion of them.
This will add complication to ingest vs playout operations, to ensure they don't remove things the other is reliant on. The common sync point of the rundownPlaylist lock will allow for coordinating this.

There is an outstanding question of whether this should be changed for buckets or not, this has not been explored yet.

Status

This has the the "Simplify the expectedPackages property" implemented (not tested), but perhaps broken due to later changes.
"Rework the ExpectedPackages collection to avoid duplicates" has been started, with the model representations being sketched out, and not yet implemented. Usages of these model changes is not fully propagated through the ingest and playout flows.

For anyone wanting to pick this up; It might be better to take inspiration from these changes instead of working from them directly.
I would be tempted to do it as follows, with each step being a separate PR:

  • Change the structure of the ExpectedPackages collection, to allow for shared ownership (but keep it 1:1 for now). types for this are drafted in this PR, but are not fully used everywhere.
  • Change the ingest behaviour, to deduplicate documents in the ExpectedPackages collection.This is implemented but not tested in this pr.
  • Change the playout behaviour to add references to these documents during playout instead of the current treatment of pieceInstances in the publication for package-manager. I see this step as the risky one, getting the lifetimes of documents correct needs some thought.
  • Restructure the expectedPackages property on pieces/adlibs/related types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant