Skip to content

Commit 7a549a8

Browse files
committed
fix: todos
1 parent 0d5ff54 commit 7a549a8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

meteor/server/publications/peripheralDeviceForDevice.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export function convertPeripheralDeviceForGateway(
6868
const allDeviceSettingsInStudio = applyAndValidateOverrides(
6969
studio.peripheralDeviceSettings.deviceSettings
7070
).obj
71-
deviceSettings = allDeviceSettingsInStudio[peripheralDevice.studioAndConfigId.configId] ?? deviceSettings
71+
deviceSettings =
72+
allDeviceSettingsInStudio[peripheralDevice.studioAndConfigId.configId]?.options ?? deviceSettings
7273
}
7374

7475
switch (peripheralDevice.category) {

packages/mos-gateway/src/mosHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { MosDeviceConfig } from './generated/devices'
3939
import { PeripheralDeviceForDevice } from '@sofie-automation/server-core-integration'
4040
import _ = require('underscore')
4141
import { MosStatusHandler } from './mosStatusHandler'
42+
import { isPromise } from 'util/types'
4243

4344
export interface MosConfig {
4445
self: IConnectionConfig
@@ -61,7 +62,7 @@ interface MosDeviceHandle {
6162
readonly deviceOptions: Readonly<MosDeviceConfig>
6263

6364
// Once connected, a core handler is setup
64-
coreMosHandler?: CoreMosDeviceHandler
65+
coreMosHandler?: CoreMosDeviceHandler | Promise<CoreMosDeviceHandler>
6566

6667
// If writing back story/item status is enabled, the setup handler
6768
statusHandler?: MosStatusHandler
@@ -288,10 +289,9 @@ export class MosHandler {
288289
return
289290
}
290291

291-
// nocommit - this is a bit of a race condition, as the deviceEntry is updated via an await
292+
// This is either a promise, if a handler is currently being setup, or the handler itself
292293
if (deviceEntry.coreMosHandler) {
293294
this._logger.error(`Got connection for mosDevice "${mosDevice.idPrimary}" which is already setup!`)
294-
// nocommit - do anything else?
295295
return
296296
}
297297

@@ -444,7 +444,7 @@ export class MosHandler {
444444
private sendStatusOfAllMosDevices() {
445445
// Send an update to Core of the status of all mos devices
446446
for (const handler of this._allMosDevices.values()) {
447-
if (handler.coreMosHandler) {
447+
if (handler.coreMosHandler && !isPromise(handler.coreMosHandler)) {
448448
handler.coreMosHandler.onMosConnectionChanged(handler.mosDevice.getConnectionStatus())
449449
}
450450
}

0 commit comments

Comments
 (0)