Skip to content

Commit 74136f1

Browse files
committed
fix: solution in b1045f9 was actually wrong, we should protect the Segment from being removed if it's nexted, it's going to be removed later
1 parent baacf0e commit 74136f1

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

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

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { unprotectString, protectString } from '@sofie-automation/corelib/dist/p
1010
import { logger } from '../logging'
1111
import { PlayoutModel } from '../playout/model/PlayoutModel'
1212
import { PlayoutRundownModel } from '../playout/model/PlayoutRundownModel'
13-
import { isTooCloseToAutonext } from '../playout/lib'
1413
import { allowedToMoveRundownOutOfPlaylist } from '../rundown'
1514
import { updatePartInstanceRanksAndOrphanedState } from '../updatePartInstanceRanksAndOrphanedState'
1615
import {
@@ -224,8 +223,6 @@ export async function CommitIngestOperation(
224223
const pSaveIngest = ingestModel.saveAllToDatabase()
225224
pSaveIngest.catch(() => null) // Ensure promise isn't reported as unhandled
226225

227-
ensureNextPartInstanceIsNotDeleted(playoutModel)
228-
229226
await validateAdlibTestingSegment(context, playoutModel)
230227

231228
try {
@@ -284,19 +281,9 @@ function canRemoveSegment(
284281
logger.warn(`Not allowing removal of current playing segment "${segmentId}", making segment unsynced instead`)
285282
return false
286283
}
287-
if (nextPartInstance?.segmentId === segmentId && isTooCloseToAutonext(currentPartInstance, false)) {
288-
// Don't allow removing an active rundown
289-
logger.warn(
290-
`Not allowing removal of nexted segment "${segmentId}", because it's too close to an auto-next, making segment unsynced instead`
291-
)
292-
return false
293-
}
294-
295-
if (nextPartInstance?.segmentId === segmentId && nextPartInstance.orphaned === 'adlib-part') {
284+
if (nextPartInstance?.segmentId === segmentId) {
296285
// Don't allow removing an active rundown
297-
logger.warn(
298-
`Not allowing removal of segment "${segmentId}" which contains nexted adlibbed part, making segment unsynced instead`
299-
)
286+
logger.warn(`Not allowing removal of nexted segment "${segmentId}", making segment unsynced instead`)
300287
return false
301288
}
302289

@@ -855,12 +842,3 @@ async function validateAdlibTestingSegment(_context: JobContext, playoutModel: P
855842
rundown.updateAdlibTestingSegmentRank()
856843
}
857844
}
858-
function ensureNextPartInstanceIsNotDeleted(playoutModel: PlayoutModel) {
859-
if (playoutModel.nextPartInstance) {
860-
// Check if the segment of the nextPartInstance exists
861-
if (!playoutModel.findSegment(playoutModel.nextPartInstance.partInstance.segmentId)) {
862-
// The segment doesn't exist, set nextPartInstance to null, it'll be set by ensureNextPartIsValid() later.
863-
playoutModel.setPartInstanceAsNext(null, false, false)
864-
}
865-
}
866-
}

0 commit comments

Comments
 (0)