From f4402ddc6b9998e9cdf6d04f3c766ba94056d4bd Mon Sep 17 00:00:00 2001 From: Mint de Wit Date: Wed, 28 Aug 2024 14:52:40 +0200 Subject: [PATCH 1/3] fix: filter mappings by deviceid --- .../src/__tests__/conductor.spec.ts | 20 ++++++++++++------- .../timeline-state-resolver/src/conductor.ts | 7 ++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts b/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts index cc23db37c..3c3650bc6 100644 --- a/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts +++ b/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts @@ -58,10 +58,16 @@ describe('Conductor', () => { deviceId: 'device1', options: {}, } - const myLayerMapping: Mappings = { + const device0Mappings: Mappings = { myLayer0: myLayerMapping0, + } + const device1Mappings: Mappings = { myLayer1: myLayerMapping1, } + const myLayerMapping: Mappings = { + ...device0Mappings, + ...device1Mappings, + } const conductor = new Conductor({ multiThreadedResolver: false, @@ -139,14 +145,14 @@ describe('Conductor', () => { }, time: 10005, }), - myLayerMapping // TODO - is this correct? + device0Mappings // TODO - is this correct? ) expect(device0.handleState).toHaveBeenNthCalledWith( 2, expect.objectContaining({ time: 11000, }), - myLayerMapping // TODO - is this correct? + device0Mappings // TODO - is this correct? ) expect(device0.handleState).toHaveBeenNthCalledWith( 3, @@ -154,7 +160,7 @@ describe('Conductor', () => { layers: {}, time: 12000, }), - myLayerMapping // TODO - is this correct? + device0Mappings // TODO - is this correct? ) // Ensure device1 has been fed sensible states @@ -165,7 +171,7 @@ describe('Conductor', () => { expect.objectContaining({ layers: {}, }), - myLayerMapping // TODO - is this correct? + device1Mappings // TODO - is this correct? ) expect(device1.handleState).toHaveBeenNthCalledWith( 2, @@ -180,14 +186,14 @@ describe('Conductor', () => { }), }, }), - myLayerMapping // TODO - is this correct? + device1Mappings // TODO - is this correct? ) expect(device1.handleState).toHaveBeenNthCalledWith( 3, expect.objectContaining({ layers: {}, }), - myLayerMapping // TODO - is this correct? + device1Mappings // TODO - is this correct? ) // Remove the device diff --git a/packages/timeline-state-resolver/src/conductor.ts b/packages/timeline-state-resolver/src/conductor.ts index 0be3bdd07..008a13b73 100644 --- a/packages/timeline-state-resolver/src/conductor.ts +++ b/packages/timeline-state-resolver/src/conductor.ts @@ -1087,8 +1087,13 @@ export class Conductor extends EventEmitter { deviceId: string, time: number, state: Timeline.TimelineState, - mappings: Mappings + unfilteredMappings: Mappings ) { + // only take mappings that are for this deviceId + const mappings = Object.fromEntries( + Object.entries>(unfilteredMappings).filter(([_, mapping]) => mapping.deviceId === deviceId) + ) + if (!this._deviceStates[deviceId]) this._deviceStates[deviceId] = [] // find all references to the datastore that are in this state From 940e68ab09a37df7ce53944d888757a4a6f5a9c9 Mon Sep 17 00:00:00 2001 From: Mint de Wit Date: Wed, 28 Aug 2024 14:54:18 +0200 Subject: [PATCH 2/3] fix: use sequential send mode for quantel --- packages/timeline-state-resolver/src/service/devices.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/timeline-state-resolver/src/service/devices.ts b/packages/timeline-state-resolver/src/service/devices.ts index 19c07b6ad..98574cbb5 100644 --- a/packages/timeline-state-resolver/src/service/devices.ts +++ b/packages/timeline-state-resolver/src/service/devices.ts @@ -146,6 +146,6 @@ export const DevicesDict: Record = { deviceClass: QuantelDevice, canConnect: true, deviceName: (deviceId: string) => 'Quantel' + deviceId, - executionMode: () => 'salvo', + executionMode: () => 'sequential', }, } From 17e3b755a64752dbafa73b5841332e265ce428db Mon Sep 17 00:00:00 2001 From: Mint de Wit Date: Fri, 30 Aug 2024 11:34:49 +0200 Subject: [PATCH 3/3] chore: remove some comments --- .../src/__tests__/conductor.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts b/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts index 3c3650bc6..984d97067 100644 --- a/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts +++ b/packages/timeline-state-resolver/src/__tests__/conductor.spec.ts @@ -145,14 +145,14 @@ describe('Conductor', () => { }, time: 10005, }), - device0Mappings // TODO - is this correct? + device0Mappings ) expect(device0.handleState).toHaveBeenNthCalledWith( 2, expect.objectContaining({ time: 11000, }), - device0Mappings // TODO - is this correct? + device0Mappings ) expect(device0.handleState).toHaveBeenNthCalledWith( 3, @@ -160,7 +160,7 @@ describe('Conductor', () => { layers: {}, time: 12000, }), - device0Mappings // TODO - is this correct? + device0Mappings ) // Ensure device1 has been fed sensible states @@ -171,7 +171,7 @@ describe('Conductor', () => { expect.objectContaining({ layers: {}, }), - device1Mappings // TODO - is this correct? + device1Mappings ) expect(device1.handleState).toHaveBeenNthCalledWith( 2, @@ -186,14 +186,14 @@ describe('Conductor', () => { }), }, }), - device1Mappings // TODO - is this correct? + device1Mappings ) expect(device1.handleState).toHaveBeenNthCalledWith( 3, expect.objectContaining({ layers: {}, }), - device1Mappings // TODO - is this correct? + device1Mappings ) // Remove the device