magnificent-dusk-62723
08/18/2025, 5:15 PMtall-airline-16756
08/18/2025, 5:15 PMtall-airline-16756
08/18/2025, 5:16 PMrotate_segment
gets called before the last rotation has finished. It often happens if calls overlap or if the previous task isn’t properly awaited.
Here’s a simple way to fix it:
• Make sure rotate_segment()
only runs after the previous rotation task has wrapped up. You can add a quick check to see if the previous task is done before moving on.
• For example, try updating your code like this:
async def rotate_segment_safely():
if not self._rotate_segment_atask.done():
await self._rotate_segment_atask # Wait for the previous task to complete
self.rotate_segment()
If you want, feel free to share more about how you’re calling rotate_segment()
or ask any questions—I’m here to help!
Sources: livekit-agents/livekit/agents/voice/transcription/synchronizer.py