mirror of
https://github.com/nasa/openmct.git
synced 2025-03-25 13:28:38 +00:00
[Aborts] Abort Telemetry Collections requests on Navigation, Add abort functionality to getLimits (#6872)
* debug * 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 * english * cant always be on * adding abort to limits requests * finally-ing off the promise * need to just return the object not the property * sticking with the try/catch structure we use elsewhere * removing abort on nav, as views should be calling destroy --------- Co-authored-by: John Hill <john.c.hill@nasa.gov> Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
This commit is contained in:
parent
42b13c4dfb
commit
244e3b7938
@ -784,6 +784,7 @@ export default class TelemetryAPI {
|
||||
*/
|
||||
getLimits(domainObject) {
|
||||
const provider = this.#findLimitEvaluator(domainObject);
|
||||
|
||||
if (!provider || !provider.getLimits) {
|
||||
return {
|
||||
limits: function () {
|
||||
@ -792,7 +793,23 @@ export default class TelemetryAPI {
|
||||
};
|
||||
}
|
||||
|
||||
return provider.getLimits(domainObject);
|
||||
const abortController = new AbortController();
|
||||
const options = { signal: abortController.signal };
|
||||
this.requestAbortControllers.add(abortController);
|
||||
|
||||
try {
|
||||
return provider.getLimits(domainObject, options);
|
||||
} catch (error) {
|
||||
if (error.name !== 'AbortError') {
|
||||
this.openmct.notifications.error(
|
||||
'Error requesting telemetry data, see console for details'
|
||||
);
|
||||
}
|
||||
|
||||
throw new Error(error);
|
||||
} finally {
|
||||
this.requestAbortControllers.delete(abortController);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user