-
Notifications
You must be signed in to change notification settings - Fork 54
feat(MOS): support OpenMedia's hot standby #1169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
e7f59e2
cef3236
484b0d7
e49715e
72c765f
ce68543
e2fe446
3f71257
685862b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,13 +59,15 @@ export class MosHandler { | |
| private _logger: Winston.Logger | ||
| private _disposed = false | ||
| private _settings?: MosGatewayConfig | ||
| private _openMediaHotStandby: Record<string, boolean> | ||
| private _coreHandler: CoreHandler | undefined | ||
| private _observers: Array<Observer<any>> = [] | ||
| private _triggerupdateDevicesTimeout: any = null | ||
| private mosTypes: MosTypes | ||
|
|
||
| constructor(logger: Winston.Logger) { | ||
| this._logger = logger | ||
| this._openMediaHotStandby = {} | ||
| this.mosTypes = getMosTypes(this.strict) // temporary, another will be set upon init() | ||
| } | ||
| async init(config: MosConfig, coreHandler: CoreHandler): Promise<void> { | ||
|
|
@@ -101,7 +103,7 @@ export class MosHandler { | |
|
|
||
| this.mosTypes = getMosTypes(this.strict) | ||
|
|
||
| await this._initMosConnection() | ||
| await this._updateDevices() | ||
|
|
||
| if (!this._coreHandler) throw Error('_coreHandler is undefined!') | ||
| this._coreHandler.onConnected(() => { | ||
|
|
@@ -110,8 +112,6 @@ export class MosHandler { | |
| this.sendStatusOfAllMosDevices() | ||
| }) | ||
| this.setupObservers() | ||
|
|
||
| return this._updateDevices() | ||
| } | ||
| async dispose(): Promise<void> { | ||
| this._disposed = true | ||
|
|
@@ -243,7 +243,11 @@ export class MosHandler { | |
|
|
||
| if (!this._coreHandler) throw Error('_coreHandler is undefined!') | ||
|
|
||
| const coreMosHandler = await this._coreHandler.registerMosDevice(mosDevice, this) | ||
| const coreMosHandler = await this._coreHandler.registerMosDevice( | ||
| mosDevice, | ||
| this, | ||
| mosDevice.idSecondary ? this._openMediaHotStandby[mosDevice.idSecondary] : false | ||
| ) | ||
| // this._logger.info('mosDevice registered -------------') | ||
| // Setup message flow between the devices: | ||
|
|
||
|
|
@@ -420,6 +424,8 @@ export class MosHandler { | |
| for (const [deviceId, device] of Object.entries<{ options: MosDeviceConfig }>(devices)) { | ||
| if (device) { | ||
| if (device.options.secondary) { | ||
| this._openMediaHotStandby[device.options.secondary.id] = | ||
| device.options.secondary?.openMediaHotStandby || false | ||
| // If the host isn't set, don't use secondary: | ||
| if (!device.options.secondary.host || !device.options.secondary.id) | ||
| delete device.options.secondary | ||
|
|
@@ -482,6 +488,11 @@ export class MosHandler { | |
| deviceOptions.primary.heartbeatInterval = | ||
| deviceOptions.primary.heartbeatInterval || DEFAULT_MOS_HEARTBEAT_INTERVAL | ||
|
|
||
| if (deviceOptions.secondary?.id && this._openMediaHotStandby[deviceOptions.secondary.id]) { | ||
| //@ts-expect-error this is not yet added to the official mos-connection | ||
| deviceOptions.secondary.openMediaHotStandby = true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that this PR is not mergable yet? Because there needs to be an update to mos-connection before?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it appears so.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sofie-Automation/sofie-mos-connection#105 Is this the PR?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was the PR, but there are some additional fixes without a PR yet |
||
| } | ||
|
|
||
| const mosDevice: MosDevice = await this.mos.connect(deviceOptions) | ||
| this._ownMosDevices[deviceId] = mosDevice | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.