Compare commits

...

4 Commits

Author SHA1 Message Date
Jamie V
9a5c292dea cant always be on 2023-07-28 16:17:41 -07:00
Jamie V
3658ec27b9 english 2023-07-28 14:29:14 -07:00
Jamie V
4eebe53193 abort any pending requests on router "change:path" event, this should catch cases where the UI is bogged down and doesnt destroy the tc first 2023-07-28 14:27:42 -07:00
Jamie V
0c633d614b debug 2023-07-28 12:29:12 -07:00

View File

@@ -91,6 +91,8 @@ export default class TelemetryCollection extends EventEmitter {
this._requestHistoricalTelemetry();
this._initiateSubscriptionTelemetry();
this.openmct.router.on('change:path', this._abortRequests);
this.loaded = true;
}
@@ -99,10 +101,7 @@ export default class TelemetryCollection extends EventEmitter {
* to remove any listeners
*/
destroy() {
if (this.requestAbort) {
this.requestAbort.abort();
}
this._abortRequests();
this._unwatchBounds();
this._unwatchTimeSystem();
this._unwatchTimeModeChange();
@@ -110,6 +109,8 @@ export default class TelemetryCollection extends EventEmitter {
this.unsubscribe();
}
this.openmct.router.off('change:path', this._abortRequests);
this.removeAllListeners();
}
@@ -141,10 +142,7 @@ export default class TelemetryCollection extends EventEmitter {
options.onPartialResponse = this._processNewTelemetry.bind(this);
try {
if (this.requestAbort) {
this.requestAbort.abort();
}
this._abortRequests();
this.requestAbort = new AbortController();
options.signal = this.requestAbort.signal;
this.emit('requestStarted');
@@ -170,6 +168,16 @@ export default class TelemetryCollection extends EventEmitter {
this._processNewTelemetry(historicalData);
}
/**
* Abort any pending requests
* @private
*/
_abortRequests() {
if (this.requestAbort) {
this.requestAbort.abort();
}
}
/**
* This uses the built in subscription function from Telemetry API
* @private