Skip to content

Commit 0064873

Browse files
ochafikclaude
andcommitted
perf(say-server): add initial delay before polling
Add 150ms delay before first poll to give TTS model time to generate the first audio chunk. This reduces unnecessary polling and server load. Current backoff after that: - 30ms if chunks received (keep streaming fast) - 80ms if no chunks (wait longer for generation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5e6ab93 commit 0064873

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

examples/say-server/server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,8 @@ def generate_sync():
922922
const app = appRef.current;
923923
if (isPollingRef.current || !app) return;
924924
isPollingRef.current = true;
925+
// Initial delay to let TTS generate first chunk (reduces unnecessary polls)
926+
await new Promise(r => setTimeout(r, 150));
925927
while (queueIdRef.current) {
926928
try {
927929
const result = await app.callServerTool({ name: "poll_tts_audio", arguments: { queue_id: queueIdRef.current } });

0 commit comments

Comments
 (0)