Skip to content

Commit e752e23

Browse files
committed
chore: doc and logging for troubleshooting
1 parent b769157 commit e752e23

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

packages/corelib/src/dataModel/Segment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SegmentNote } from './Notes'
55
export enum SegmentOrphanedReason {
66
/** Segment is deleted from the NRCS but we still need it */
77
DELETED = 'deleted',
8-
/** Segment should be hidden, but it is still playing */
8+
/** Blueprints want the Segment to be hidden, but it is still playing so is must not be hidden right now. */
99
HIDDEN = 'hidden',
1010
/** Segment is owned by playout, and is for AdlibTesting in its rundown */
1111
ADLIB_TESTING = 'adlib-testing',

packages/job-worker/src/ingest/commit.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ export async function CommitIngestOperation(
178178
// Ensure any adlibbed parts are updated to follow the segmentId of the previous part
179179
await updateSegmentIdsForAdlibbedPartInstances(context, ingestModel, beforePartMap)
180180

181+
if (data.renamedSegments && data.renamedSegments.size > 0) {
182+
logger.debug(`Renamed segments: ${JSON.stringify(Array.from(data.renamedSegments.entries()))}`)
183+
}
181184
// ensure instances have matching segmentIds with the parts
182185
await updatePartInstancesSegmentIds(context, ingestModel, data.renamedSegments, beforePartMap)
183186

@@ -397,6 +400,34 @@ async function updatePartInstancesSegmentIds(
397400
}
398401
}
399402
if (writeOps.length) await context.directCollections.PartInstances.bulkWrite(writeOps)
403+
404+
// Double check that there are no parts using the old segment ids:
405+
const oldSegmentIds = Array.from(renameRules.keys())
406+
const [badPartInstances, badParts] = await Promise.all([
407+
await context.directCollections.PartInstances.findFetch({
408+
rundownId: ingestModel.rundownId,
409+
segmentId: { $in: oldSegmentIds },
410+
}),
411+
await context.directCollections.Parts.findFetch({
412+
rundownId: ingestModel.rundownId,
413+
segmentId: { $in: oldSegmentIds },
414+
}),
415+
])
416+
if (badPartInstances.length > 0) {
417+
logger.error(
418+
`updatePartInstancesSegmentIds: Failed to update all PartInstances using old SegmentIds "${JSON.stringify(
419+
oldSegmentIds
420+
)}": ${JSON.stringify(badPartInstances)}, writeOps: ${JSON.stringify(writeOps)}`
421+
)
422+
}
423+
424+
if (badParts.length > 0) {
425+
logger.error(
426+
`updatePartInstancesSegmentIds: Failed to update all Parts using old SegmentIds "${JSON.stringify(
427+
oldSegmentIds
428+
)}": ${JSON.stringify(badParts)}, writeOps: ${JSON.stringify(writeOps)}`
429+
)
430+
}
400431
}
401432
}
402433

packages/job-worker/src/ingest/model/IngestSegmentModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export interface IngestSegmentModel extends IngestSegmentModelReadonly {
6767
setOrphaned(orphaned: SegmentOrphanedReason | undefined): void
6868

6969
/**
70-
* Mark this Part as being hidden
70+
* Mark this Segment as being hidden
7171
* @param hidden New hidden state
7272
*/
7373
setHidden(hidden: boolean): void

0 commit comments

Comments
 (0)