Skip to content

feat: track http synth latencies; misc bugs#612

Open
RG-04 wants to merge 2 commits intomasterfrom
feat/synth-http-latencies
Open

feat: track http synth latencies; misc bugs#612
RG-04 wants to merge 2 commits intomasterfrom
feat/synth-http-latencies

Conversation

@RG-04
Copy link
Copy Markdown
Contributor

@RG-04 RG-04 commented Mar 30, 2026

  • Add Latency tracking for HTTP synthesizers
  • Prevents early return in generate_http_loop (bug)
  • Prevents setting cache on null responses from the synthesizer implementations, usually arising due to API errors

Comment thread bolna/synthesizer/stream_synthesizer.py Outdated
await self._push_stream(message)
else:
self.internal_queue.put_nowait(copy.deepcopy(message))
super().push(message)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseSynthesizer.push() is async def — doesn't this need an await? Without it the coroutine is created but never executed, so the message never reaches internal_queue and _generate_http_loop will hang on get().

Comment thread bolna/synthesizer/stream_synthesizer.py Outdated
await self._push_stream(message)
else:
self.internal_queue.put_nowait(copy.deepcopy(message))
super().push(message)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code did copy.deepcopy(message) before enqueuing. BaseSynthesizer.push() does a plain put_nowait(message) with no copy. Since _generate_http_loop mutates meta_info in-place (sets format, text, mark_id, etc.), this could corrupt the caller's original dict. Should the deepcopy be preserved here?

self.first_chunk_generated = False
self.synthesized_characters = 0
self.model = "default"
self.current_turn_start_time = None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current_turn_id is set in _stamp_turn_start (line 108) and read in _record_turn_latency (line 116) but isn't initialized here. Might be worth adding self.current_turn_id = None alongside current_turn_start_time for safety.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants