1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-05 19:33:47 +01:00
This commit is contained in:
J. Nick Koston
2025-06-16 15:11:42 +02:00
parent f80aeb1d1d
commit b35b54f2c2

View File

@@ -388,17 +388,10 @@ void load_ble_event(BLEEvent *event, esp_gatts_cb_event_t e, esp_gatt_if_t i, es
} }
template<typename... Args> void enqueue_ble_event(Args... args) { template<typename... Args> void enqueue_ble_event(Args... args) {
// Check if queue is full before allocating
if (global_ble->ble_events_.full()) {
// Queue is full, drop the event
global_ble->ble_events_.increment_dropped_count();
return;
}
// Allocate an event from the pool // Allocate an event from the pool
BLEEvent *event = global_ble->ble_event_pool_.allocate(); BLEEvent *event = global_ble->ble_event_pool_.allocate();
if (event == nullptr) { if (event == nullptr) {
// Pool is full, drop the event // No events available - queue is full or we're out of memory
global_ble->ble_events_.increment_dropped_count(); global_ble->ble_events_.increment_dropped_count();
return; return;
} }