mirror of
https://github.com/nasa/openmct.git
synced 2025-06-02 23:50:49 +00:00
fix slow loading errors
This commit is contained in:
parent
8e5ac68360
commit
154e8c695d
@ -73,6 +73,10 @@ export default class TelemetryCollection extends EventEmitter {
|
|||||||
this.isStrategyLatest = this.options.strategy === 'latest';
|
this.isStrategyLatest = this.options.strategy === 'latest';
|
||||||
this.dataOutsideTimeBounds = false;
|
this.dataOutsideTimeBounds = false;
|
||||||
this.modeChanged = false;
|
this.modeChanged = false;
|
||||||
|
|
||||||
|
console.debug(
|
||||||
|
`🫙 Created telemetry for ${this.domainObject.name} with bounds ${options.start} and ${options.end}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -86,6 +90,16 @@ export default class TelemetryCollection extends EventEmitter {
|
|||||||
|
|
||||||
this._setTimeSystem(this.options.timeContext.getTimeSystem());
|
this._setTimeSystem(this.options.timeContext.getTimeSystem());
|
||||||
this.lastBounds = this.options.timeContext.getBounds();
|
this.lastBounds = this.options.timeContext.getBounds();
|
||||||
|
// prioritize passed options over time bounds
|
||||||
|
if (this.options.start) {
|
||||||
|
this.lastBounds.start = this.options.start;
|
||||||
|
}
|
||||||
|
if (this.options.end) {
|
||||||
|
this.lastBounds.end = this.options.end;
|
||||||
|
}
|
||||||
|
console.debug(
|
||||||
|
`🫙 Bounds for collection are start ${this.lastBounds.start} and end ${this.lastBounds.end}`
|
||||||
|
);
|
||||||
this._watchBounds();
|
this._watchBounds();
|
||||||
this._watchTimeSystem();
|
this._watchTimeSystem();
|
||||||
this._watchTimeModeChange();
|
this._watchTimeModeChange();
|
||||||
@ -215,20 +229,13 @@ export default class TelemetryCollection extends EventEmitter {
|
|||||||
let hasDataBeforeStartBound = false;
|
let hasDataBeforeStartBound = false;
|
||||||
let size = this.options.size;
|
let size = this.options.size;
|
||||||
let enforceSize = size !== undefined && this.options.enforceSize;
|
let enforceSize = size !== undefined && this.options.enforceSize;
|
||||||
// prioritize request bounds over time context bounds
|
console.debug(`🫙 Bounds are telemetry are currently`, this.lastBounds);
|
||||||
let boundsToUse = this.lastBounds;
|
|
||||||
if (this.options.start) {
|
|
||||||
boundsToUse.start = this.options.start;
|
|
||||||
}
|
|
||||||
if (this.options.end) {
|
|
||||||
boundsToUse.end = this.options.end;
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop through, sort and dedupe
|
// loop through, sort and dedupe
|
||||||
for (let datum of data) {
|
for (let datum of data) {
|
||||||
parsedValue = this.parseTime(datum);
|
parsedValue = this.parseTime(datum);
|
||||||
beforeStartOfBounds = parsedValue < boundsToUse.start;
|
beforeStartOfBounds = parsedValue < this.lastBounds.start;
|
||||||
afterEndOfBounds = parsedValue > boundsToUse.end;
|
afterEndOfBounds = parsedValue > this.lastBounds.end;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!afterEndOfBounds &&
|
!afterEndOfBounds &&
|
||||||
@ -335,6 +342,10 @@ export default class TelemetryCollection extends EventEmitter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.debug(
|
||||||
|
`🫙 Bounds CHANGED for ${this.domainObject.name} are start ${bounds.start} and end ${bounds.end}`
|
||||||
|
);
|
||||||
|
|
||||||
let startChanged = this.lastBounds.start !== bounds.start;
|
let startChanged = this.lastBounds.start !== bounds.start;
|
||||||
let endChanged = this.lastBounds.end !== bounds.end;
|
let endChanged = this.lastBounds.end !== bounds.end;
|
||||||
|
|
||||||
|
@ -7,14 +7,11 @@ export default class CompsManager extends EventEmitter {
|
|||||||
#composition;
|
#composition;
|
||||||
#telemetryObjects = {};
|
#telemetryObjects = {};
|
||||||
#telemetryCollections = {};
|
#telemetryCollections = {};
|
||||||
#dataFrame = {};
|
|
||||||
#telemetryLoadedPromises = [];
|
#telemetryLoadedPromises = [];
|
||||||
#telemetryOptions = {};
|
#telemetryOptions = {};
|
||||||
#loaded = false;
|
#loaded = false;
|
||||||
#compositionLoaded = false;
|
#compositionLoaded = false;
|
||||||
#telemetryProcessors = {};
|
#telemetryProcessors = {};
|
||||||
// make id random 4 digit number
|
|
||||||
#id = Math.floor(Math.random() * 9000) + 1000;
|
|
||||||
|
|
||||||
constructor(openmct, domainObject) {
|
constructor(openmct, domainObject) {
|
||||||
super();
|
super();
|
||||||
@ -111,8 +108,11 @@ export default class CompsManager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load(telemetryOptions) {
|
async load(telemetryOptions) {
|
||||||
// if our options change, we need to reload the composition
|
|
||||||
if (!_.isEqual(telemetryOptions, this.#telemetryOptions) && this.#loaded) {
|
if (!_.isEqual(telemetryOptions, this.#telemetryOptions) && this.#loaded) {
|
||||||
|
console.debug(
|
||||||
|
`😩 Reloading comps manager ${this.#domainObject.name} due to telemetry options change`,
|
||||||
|
telemetryOptions
|
||||||
|
);
|
||||||
this.#destroy();
|
this.#destroy();
|
||||||
}
|
}
|
||||||
this.#telemetryOptions = telemetryOptions;
|
this.#telemetryOptions = telemetryOptions;
|
||||||
@ -121,13 +121,13 @@ export default class CompsManager extends EventEmitter {
|
|||||||
this.#compositionLoaded = true;
|
this.#compositionLoaded = true;
|
||||||
}
|
}
|
||||||
if (!this.#loaded) {
|
if (!this.#loaded) {
|
||||||
await this.startListeningToUnderlyingTelemetry();
|
await this.#startListeningToUnderlyingTelemetry();
|
||||||
this.#telemetryLoadedPromises = [];
|
this.#telemetryLoadedPromises = [];
|
||||||
this.#loaded = true;
|
this.#loaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async startListeningToUnderlyingTelemetry() {
|
async #startListeningToUnderlyingTelemetry() {
|
||||||
Object.keys(this.#telemetryCollections).forEach((keyString) => {
|
Object.keys(this.#telemetryCollections).forEach((keyString) => {
|
||||||
if (!this.#telemetryCollections[keyString].loaded) {
|
if (!this.#telemetryCollections[keyString].loaded) {
|
||||||
this.#telemetryCollections[keyString].on('add', this.#getTelemetryProcessor(keyString));
|
this.#telemetryCollections[keyString].on('add', this.#getTelemetryProcessor(keyString));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user