FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix schedule speech on windows when monotonic_ns resolution is rough by longcw · Pull Request #2770 · livekit/agents · GitHub

/ agents Public

fix schedule speech on windows when monotonic_ns resolution is rough - #2770

Merged
longcw merged 2 commits into
mainfrom
longc/fix-schedule-speech
Jul 1, 2025
Merged

fix schedule speech on windows when monotonic_ns resolution is rough#2770
longcw merged 2 commits into
mainfrom
longc/fix-schedule-speech

Conversation

longcw commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Before python 3.13, on Windows, time.monotonic() uses gGetTickCount64() clock which has a resolution of 15.6 ms.
python/cpython#116781

Replaced it with time.perf_counter_ns for python < 3.13 on Windows, fix #2764

davidzhao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nice fix!

# negate the priority to make it a max heap
heapq.heappush(self._speech_q, (-priority, time.perf_counter_ns(), speech))
break
except TypeError:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

maybe comment here on why TypeError is thrown? (it's clear when reading the bug, but that context is lost when reading the code alone)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Interrupt user example throws error and conversation turn order disrupted

3 participants


Back | FazBrowse Home | New Git URL