Skip to content

Commit 484b0d7

Browse files
committed
wip: hotStandby - comment error message behavior
1 parent cef3236 commit 484b0d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/mos-gateway/src/CoreMosDeviceHandler.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ export class CoreMosDeviceHandler {
141141
const messages: Array<string> = []
142142

143143
if (this._hotStandby) {
144+
// OpenMedia treats secondary server as hot-standby
145+
// And thus is not considered as a warning if it's not connected
144146
if (connectionStatus.PrimaryConnected) {
145147
statusCode = StatusCode.GOOD
146148
} else {
149+
// Primary not connected is only bad if there is no secondary:
147150
if (connectionStatus.SecondaryConnected) {
148151
statusCode = StatusCode.GOOD
149152
messages.push(connectionStatus.SecondaryStatus || 'Running NRCS on hot standby')
@@ -154,15 +157,18 @@ export class CoreMosDeviceHandler {
154157
}
155158
} else {
156159
if (connectionStatus.PrimaryConnected) {
160+
// ENPS expect both Primary and Secondary to be connected if both of them are configured
157161
if (connectionStatus.SecondaryConnected || !this._mosDevice.idSecondary) {
158162
statusCode = StatusCode.GOOD
159163
} else {
160164
statusCode = StatusCode.WARNING_MINOR
161165
}
162166
} else {
163167
if (connectionStatus.SecondaryConnected) {
168+
// Primary not connected should give a warning if Secondary is used.
164169
statusCode = StatusCode.WARNING_MAJOR
165170
} else {
171+
// If neither Primary nor Secondary is connected, it's a bad state.
166172
statusCode = StatusCode.BAD
167173
}
168174
}

0 commit comments

Comments
 (0)