diff --git a/lib/utils/tts-streaming-buffer.js b/lib/utils/tts-streaming-buffer.js index f3813ef6..de55342d 100644 --- a/lib/utils/tts-streaming-buffer.js +++ b/lib/utils/tts-streaming-buffer.js @@ -8,7 +8,7 @@ const { const MAX_CHUNK_SIZE = 1800; const HIGH_WATER_BUFFER_SIZE = 1000; const LOW_WATER_BUFFER_SIZE = 200; -const TIMEOUT_RETRY_MSECS = 3000; +const TIMEOUT_RETRY_MSECS = 1000; // 1 second const isWhitespace = (str) => /^\s*$/.test(str); @@ -377,6 +377,7 @@ class TtsStreamingBuffer extends Emitter { _onTimeout() { this.logger.debug('TtsStreamingBuffer:_onTimeout Timeout waiting for sentence boundary'); + this.timer = null; // Check if new text has been added since the timer was set. const now = Date.now(); if (now - this.lastUpdateTime < TIMEOUT_RETRY_MSECS) { @@ -384,7 +385,6 @@ class TtsStreamingBuffer extends Emitter { this._setTimerIfNeeded(); return; } - this.timer = null; this._feedQueue(true); }