mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
replace size with isNull for jsondoc. size() walks a linked-list to count the elements, so its time complexity is O(n).
This commit is contained in:
@@ -306,7 +306,7 @@ void WebSchedulerService::publish(const bool force) {
|
|||||||
|
|
||||||
ha_registered_ = ha_created;
|
ha_registered_ = ha_created;
|
||||||
|
|
||||||
if (doc.size() > 0) {
|
if (!doc.isNull()) {
|
||||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||||
snprintf(topic, sizeof(topic), "%s_data", F_(scheduler));
|
snprintf(topic, sizeof(topic), "%s_data", F_(scheduler));
|
||||||
Mqtt::queue_publish(topic, doc.as<JsonObject>());
|
Mqtt::queue_publish(topic, doc.as<JsonObject>());
|
||||||
|
|||||||
Reference in New Issue
Block a user