This commit is contained in:
2025-11-14 12:23:39 +03:00
parent 94fb4c6a48
commit 078e3f38f2
6 changed files with 31 additions and 5 deletions

View File

@@ -461,6 +461,18 @@ public:
}
}
void setTelemetryUpdateTimeout(traits::mcc_time_duration_c auto const& timeout)
{
if (timeout.count() > 0) {
_currentUpdateTimeout = std::chrono::duration_cast<decltype(_currentUpdateTimeout)>(timeout);
}
}
auto getTelemetryUpdateTimeout() const
{
return _currentUpdateTimeout;
}
// asynchronuosly periodicaly update telemetry data (internal synchronization)
void startInternalTelemetryDataUpdating()
{
@@ -475,7 +487,7 @@ public:
[this](std::stop_token stop_token) -> error_t {
while (!stop_token.stop_requested()) {
// while (true) {
_lastUpdateError = updateTelemetryData(defaultInternalUpdateTimeout);
_lastUpdateError = updateTelemetryData(_currentUpdateTimeout);
if (_lastUpdateError) {
*_internalUpdating = false;
return _lastUpdateError;
@@ -568,6 +580,8 @@ public:
// unblock waiting threads even in the case of timeout!
_updateCondVar->notify_all();
// *_isDataUpdated = false;
return _lastUpdateError;
}
@@ -707,6 +721,8 @@ protected:
std::future<error_t> _internalUpdatingFuture{};
std::stop_source _internalUpdatingStopSource{};
std::chrono::nanoseconds _currentUpdateTimeout{defaultInternalUpdateTimeout};
std ::function<error_t(std::stop_token)> _updateTargetFunc{};
// std ::function<error_t(bool, std::stop_token)> _updateTargetFunc{};
std::function<error_t(std::stop_token)> _updateFunc{};