Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Aborts] Abort Telemetry Collections requests on Navigation, Add abort functionality to getLimits #6872

Merged
merged 12 commits into from
Aug 24, 2023
19 changes: 18 additions & 1 deletion src/api/telemetry/TelemetryAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ export default class TelemetryAPI {
*/
getLimits(domainObject) {
const provider = this.#findLimitEvaluator(domainObject);

if (!provider || !provider.getLimits) {
return {
limits: function () {
Expand All @@ -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);
}
}
}

Expand Down