@@ -62,6 +62,10 @@ interface IStoryItemChange {
62
62
itemDiff : PartialDeep < IMOSItem >
63
63
}
64
64
65
+ export interface CoreMosDeviceHandlerOptions {
66
+ openMediaHotStandby ?: boolean
67
+ }
68
+
65
69
/**
66
70
* Represents a connection between a mos-device and Core
67
71
*/
@@ -76,13 +80,20 @@ export class CoreMosDeviceHandler {
76
80
private _pendingStoryItemChanges : Array < IStoryItemChange > = [ ]
77
81
private _pendingChangeTimeout : number = 60 * 1000
78
82
private mosTypes : MosTypes
83
+ private _options : CoreMosDeviceHandlerOptions
79
84
80
85
private _messageQueue : Queue
81
86
82
- constructor ( parent : CoreHandler , mosDevice : IMOSDevice , mosHandler : MosHandler ) {
87
+ constructor (
88
+ parent : CoreHandler ,
89
+ mosDevice : IMOSDevice ,
90
+ mosHandler : MosHandler ,
91
+ options : CoreMosDeviceHandlerOptions
92
+ ) {
83
93
this . _coreParentHandler = parent
84
94
this . _mosDevice = mosDevice
85
95
this . _mosHandler = mosHandler
96
+ this . _options = options
86
97
87
98
this . _messageQueue = new Queue ( )
88
99
@@ -139,25 +150,47 @@ export class CoreMosDeviceHandler {
139
150
let statusCode : StatusCode
140
151
const messages : Array < string > = [ ]
141
152
142
- if ( connectionStatus . PrimaryConnected ) {
143
- if ( connectionStatus . SecondaryConnected || ! this . _mosDevice . idSecondary ) {
153
+ if ( this . _options . openMediaHotStandby ) {
154
+ // OpenMedia treats secondary server as hot-standby
155
+ // And thus is not considered as a warning if it's not connected
156
+ if ( connectionStatus . PrimaryConnected ) {
144
157
statusCode = StatusCode . GOOD
145
158
} else {
146
- statusCode = StatusCode . WARNING_MINOR
159
+ // Primary not connected is only bad if there is no secondary:
160
+ if ( connectionStatus . SecondaryConnected ) {
161
+ statusCode = StatusCode . GOOD
162
+ messages . push ( connectionStatus . SecondaryStatus || 'Running NRCS on hot standby' )
163
+ } else {
164
+ statusCode = StatusCode . BAD
165
+ // Send messages for both connections
166
+ messages . push ( connectionStatus . PrimaryStatus || 'Primary and hot standby are not connected' )
167
+ messages . push ( connectionStatus . SecondaryStatus || 'Primary and hot standby are not connected' )
168
+ }
147
169
}
148
170
} else {
149
- if ( connectionStatus . SecondaryConnected ) {
150
- statusCode = StatusCode . WARNING_MAJOR
171
+ if ( connectionStatus . PrimaryConnected ) {
172
+ // ENPS expect both Primary and Secondary to be connected if both of them are configured
173
+ if ( connectionStatus . SecondaryConnected || ! this . _mosDevice . idSecondary ) {
174
+ statusCode = StatusCode . GOOD
175
+ } else {
176
+ statusCode = StatusCode . WARNING_MINOR
177
+ }
151
178
} else {
152
- statusCode = StatusCode . BAD
179
+ if ( connectionStatus . SecondaryConnected ) {
180
+ // Primary not connected should give a warning if Secondary is used.
181
+ statusCode = StatusCode . WARNING_MAJOR
182
+ } else {
183
+ // If neither Primary nor Secondary is connected, it's a bad state.
184
+ statusCode = StatusCode . BAD
185
+ }
153
186
}
154
- }
155
187
156
- if ( ! connectionStatus . PrimaryConnected ) {
157
- messages . push ( connectionStatus . PrimaryStatus || 'Primary not connected' )
158
- }
159
- if ( this . _mosDevice . idSecondary && ! connectionStatus . SecondaryConnected ) {
160
- messages . push ( connectionStatus . SecondaryStatus || 'Fallback not connected' )
188
+ if ( ! connectionStatus . PrimaryConnected ) {
189
+ messages . push ( connectionStatus . PrimaryStatus || 'Primary not connected' )
190
+ }
191
+ if ( this . _mosDevice . idSecondary && ! connectionStatus . SecondaryConnected ) {
192
+ messages . push ( connectionStatus . SecondaryStatus || 'Fallback not connected' )
193
+ }
161
194
}
162
195
163
196
this . core
0 commit comments