mirror of
https://github.com/esphome/esphome.git
synced 2025-08-09 11:57:46 +00:00
Merge remote-tracking branch 'upstream/dev' into integration
This commit is contained in:
commit
cf647f0c36
@ -125,15 +125,15 @@ void DeferredUpdateEventSource::process_deferred_queue_() {
|
|||||||
if (this->send(message.c_str(), "state") != DISCARDED) {
|
if (this->send(message.c_str(), "state") != DISCARDED) {
|
||||||
// O(n) but memory efficiency is more important than speed here which is why std::vector was chosen
|
// O(n) but memory efficiency is more important than speed here which is why std::vector was chosen
|
||||||
deferred_queue_.erase(deferred_queue_.begin());
|
deferred_queue_.erase(deferred_queue_.begin());
|
||||||
consecutive_send_failures_ = 0; // Reset failure count on successful send
|
this->consecutive_send_failures_ = 0; // Reset failure count on successful send
|
||||||
} else {
|
} else {
|
||||||
consecutive_send_failures_++;
|
this->consecutive_send_failures_++;
|
||||||
if (consecutive_send_failures_ >= MAX_CONSECUTIVE_SEND_FAILURES) {
|
if (this->consecutive_send_failures_ >= MAX_CONSECUTIVE_SEND_FAILURES) {
|
||||||
// Too many failures, connection is likely dead
|
// Too many failures, connection is likely dead
|
||||||
ESP_LOGW(TAG, "Closing stuck EventSource connection after %" PRIu16 " failed sends",
|
ESP_LOGW(TAG, "Closing stuck EventSource connection after %" PRIu16 " failed sends",
|
||||||
consecutive_send_failures_);
|
this->consecutive_send_failures_);
|
||||||
this->close();
|
this->close();
|
||||||
deferred_queue_.clear();
|
this->deferred_queue_.clear();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ void DeferredUpdateEventSource::deferrable_send_state(void *source, const char *
|
|||||||
if (this->send(message.c_str(), "state") == DISCARDED) {
|
if (this->send(message.c_str(), "state") == DISCARDED) {
|
||||||
deq_push_back_with_dedup_(source, message_generator);
|
deq_push_back_with_dedup_(source, message_generator);
|
||||||
} else {
|
} else {
|
||||||
consecutive_send_failures_ = 0; // Reset failure count on successful send
|
this->consecutive_send_failures_ = 0; // Reset failure count on successful send
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user