Skip to content

Commit c83a37b

Browse files
authored
fix: PlayoutModel has unsaved changes (Sofie-Automation#1697)
1 parent 31e7596 commit c83a37b

6 files changed

Lines changed: 7 additions & 2 deletions

File tree

packages/job-worker/src/playout/model/implementation/PlayoutModelImpl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,11 +737,11 @@ export class PlayoutModelImpl extends PlayoutModelReadonlyImpl implements Playou
737737
this.#playlistHasChanged
738738
? this.context.directCollections.RundownPlaylists.replace(this.playlistImpl)
739739
: undefined,
740-
...writePartInstancesAndPieceInstances(this.context, this.allPartInstances),
741740
writeAdlibTestingSegments(this.context, this.rundownsImpl),
742741
...Array.from(partInstancesByRundownId.entries()).map(async ([rundownId, partInstances]) =>
743742
writeExpectedPackagesForPlayoutSources(this.context, this.playlistId, rundownId, partInstances)
744743
),
744+
...writePartInstancesAndPieceInstances(this.context, this.allPartInstances), // After the ExpectedPackages, as this clears the change flags
745745
this.#baselineHelper.saveAllToDatabase(),
746746
this.#notificationsHelper.saveAllToDatabase(),
747747
this.context.saveRouteSetChanges(),

packages/job-worker/src/playout/model/implementation/PlayoutPieceInstanceModelImpl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class PlayoutPieceInstanceModelImpl implements PlayoutPieceInstanceModel
8080
*/
8181
clearChangedFlag(): void {
8282
this.#hasChanges = false
83+
this.updatedExpectedPackages = null
8384
}
8485

8586
get pieceInstance(): ReadonlyDeep<PieceInstance> {

packages/job-worker/src/workers/context/JobContextImpl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class JobContextImpl extends StudioCacheContextImpl implements JobContext
3434
private readonly locksManager: LocksManager,
3535
private readonly transaction: ApmTransaction | undefined,
3636
private readonly queueJob: QueueJobFunc,
37+
private readonly jobName: string,
3738
private readonly fastTrackTimeline: FastTrackTimelineFunc | null
3839
) {
3940
super(directCollections, cacheData)
@@ -126,7 +127,7 @@ export class JobContextImpl extends StudioCacheContextImpl implements JobContext
126127
try {
127128
cache.assertNoChanges()
128129
} catch (e) {
129-
logger.warn(`${cache.displayName} has unsaved changes: ${stringifyError(e)}`)
130+
logger.warn(`${cache.displayName} from "${this.jobName}" has unsaved changes: ${stringifyError(e)}`)
130131
}
131132
}
132133
}

packages/job-worker/src/workers/events/child.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export class EventsWorkerChild {
127127
this.#locks,
128128
transaction,
129129
this.#queueJob,
130+
jobName,
130131
this.#fastTrackTimeline
131132
)
132133

packages/job-worker/src/workers/ingest/child.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export class IngestWorkerChild {
114114
this.#locks,
115115
transaction,
116116
this.#queueJob,
117+
jobName,
117118
this.#fastTrackTimeline
118119
)
119120

packages/job-worker/src/workers/studio/child.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export class StudioWorkerChild {
124124
this.#locks,
125125
transaction,
126126
this.#queueJob,
127+
jobName,
127128
this.#fastTrackTimeline
128129
)
129130

0 commit comments

Comments
 (0)