diff --git a/communication/src/ping.h b/communication/src/ping.h index 929ac1f78e..1dd7d55a05 100644 --- a/communication/src/ping.h +++ b/communication/src/ping.h @@ -45,9 +45,11 @@ class Pinger // TODO: It feels that this logic should have been implemented in the system layer if ( !(this->keepalive_source == KeepAliveSource::USER && source == KeepAliveSource::SYSTEM) ) { - this->ping_interval = interval; this->keepalive_source = source; - return true; + if (this->ping_interval != interval) { + this->ping_interval = interval; + return true; + } } return false; } diff --git a/system/src/system_cloud_internal.cpp b/system/src/system_cloud_internal.cpp index cb9bfb214b..b6c54d6a33 100644 --- a/system/src/system_cloud_internal.cpp +++ b/system/src/system_cloud_internal.cpp @@ -1109,6 +1109,9 @@ bool publishKeepaliveInterval(unsigned interval) { return false; } } + // TODO: Even though the keepalive interval is not supposed to be changed frequently, it would be + // nice to make sure the previously published event is either sent or cancelled before publishing + // a new event. This would help to mitigate the effect of possible out of order delivery char buf[16] = {}; snprintf(buf, sizeof(buf), "%u", interval); return publishEvent(KEEPALIVE_INTERVAL_EVENT, buf);