Skip to content

Commit

Permalink
Check that the mdb override is of parameter type. Discard any other m…
Browse files Browse the repository at this point in the history
…db overrides (like algorithms) (#382)

* Check that the mdb override is of parameter type. Discard any other mdb overrides (like algorithms)

* Small change to logic

* Fix search test locator

* Address review comments

* fix: typo

---------

Co-authored-by: Mazzella, Jesse D. (ARC-TI)[KBR Wyle Services, LLC] <[email protected]>
  • Loading branch information
shefalijoshi and ozyx authored Feb 5, 2024
1 parent 0cc26ed commit 97dc6e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ export const MDB_OBJECT = Object.freeze({
},
type: MDB_TYPE
});

export const MDB_CHANGES_PARAMETER_TYPE = 'PARAMETER';
10 changes: 9 additions & 1 deletion src/providers/realtime-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {
AGGREGATE_TYPE,
METADATA_TIME_KEY,
STALENESS_STATUS_MAP,
MDB_OBJECT
MDB_OBJECT,
MDB_CHANGES_PARAMETER_TYPE
} from '../const.js';
import {
buildStalenessResponseObject,
Expand Down Expand Up @@ -359,6 +360,9 @@ export default class RealtimeProvider {
subscriptionDetails.callback(datum);
}
} else if (this.isMdbChangesMessage(message)) {
if (!this.isParameterType(message)) {
return;
}
const parameterName = message.data.parameterOverride.parameter;

Check failure on line 366 in src/providers/realtime-provider.js

View workflow job for this annotation

GitHub Actions / lint

Expected blank line before this statement
if (this.observingLimitChanges[parameterName] !== undefined) {
const alarmRange = message.data.parameterOverride.defaultAlarm?.staticAlarmRange ?? [];
Expand Down Expand Up @@ -400,4 +404,8 @@ export default class RealtimeProvider {
isMdbChangesMessage(message) {
return message.type === DATA_TYPES.DATA_TYPE_MDB_CHANGES;
}

isParameterType(message) {
return message.data?.type === MDB_CHANGES_PARAMETER_TYPE;
}
}

0 comments on commit 97dc6e6

Please sign in to comment.