From 0d251fb76b61c1375607c1610c0c048ac23a961f Mon Sep 17 00:00:00 2001 From: Kevin Ahrendt Date: Mon, 18 Nov 2024 09:26:07 -0500 Subject: [PATCH] block task if no data is read from http connection (#200) --- esphome/components/nabu/audio_reader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/nabu/audio_reader.cpp b/esphome/components/nabu/audio_reader.cpp index 66fc026..d8f1c0e 100644 --- a/esphome/components/nabu/audio_reader.cpp +++ b/esphome/components/nabu/audio_reader.cpp @@ -14,7 +14,7 @@ namespace nabu { static const size_t READ_WRITE_TIMEOUT_MS = 20; // The number of times the http read times out with no data before throwing an error -static const size_t ERROR_COUNT_NO_DATA_READ_TIMEOUT = 10; +static const size_t ERROR_COUNT_NO_DATA_READ_TIMEOUT = 50; AudioReader::AudioReader(esphome::RingBuffer *output_ring_buffer, size_t transfer_buffer_size) { this->output_ring_buffer_ = output_ring_buffer; @@ -188,6 +188,7 @@ AudioReaderState AudioReader::http_read_() { this->cleanup_connection_(); return AudioReaderState::FAILED; } + vTaskDelay(pdMS_TO_TICKS(READ_WRITE_TIMEOUT_MS)); } } }