mirror of
https://github.com/nasa/openmct.git
synced 2024-12-28 08:58:52 +00:00
[Telemetry] Stop refreshing on destroy
Stop polling for updates to telemetry data from TelemetryController when scope is destroyed. Addresses some performance issues observed in WTD-614, autoflow tabular views (although this view doesn't use TelemetryController directly, the continuing of this polling in the background can slow down updates when it is showing.)
This commit is contained in:
parent
34bb2ff51a
commit
becc858349
@ -49,7 +49,11 @@ define(
|
||||
|
||||
// Used for getTelemetryObjects; a reference is
|
||||
// stored so that this can be called in a watch
|
||||
telemetryObjects: []
|
||||
telemetryObjects: [],
|
||||
|
||||
// Whether or not this controller is active; once
|
||||
// scope is destroyed, polling should stop.
|
||||
active: true
|
||||
};
|
||||
|
||||
// Broadcast that a telemetryUpdate has occurred.
|
||||
@ -227,14 +231,25 @@ define(
|
||||
}
|
||||
|
||||
self.refreshing = false;
|
||||
startTimeout();
|
||||
|
||||
if (self.active) {
|
||||
startTimeout();
|
||||
}
|
||||
}, self.interval);
|
||||
}
|
||||
}
|
||||
|
||||
// Stop polling for changes
|
||||
function deactivate() {
|
||||
self.active = false;
|
||||
}
|
||||
|
||||
// Watch for a represented domain object
|
||||
$scope.$watch("domainObject", getTelemetryObjects);
|
||||
|
||||
// Stop polling when destroyed
|
||||
$scope.$on("$destroy", deactivate);
|
||||
|
||||
// Begin polling for data changes
|
||||
startTimeout();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user