Skip to content

Commit

Permalink
chore: fix type check for worker and cpu monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
longcw committed Nov 11, 2024
1 parent 28e8e7b commit 2e1f551
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion livekit-agents/livekit/agents/utils/hw/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def cpu_percent(self, interval: float = 0.5) -> float:

class DefaultCPUMonitor(CPUMonitor):
def cpu_count(self) -> float:
return psutil.cpu_count()
return psutil.cpu_count() or 0

def cpu_percent(self, interval: float = 0.5) -> float:
return psutil.cpu_percent(interval) / 100.0
Expand Down
3 changes: 3 additions & 0 deletions livekit-agents/livekit/agents/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ async def _recv_task():
await utils.aio.gracefully_cancel(*tasks)

async def _reload_jobs(self, jobs: list[RunningJobInfo]) -> None:
if not self._opts.api_secret:
raise RuntimeError("api_secret is required to reload jobs")

for aj in jobs:
logger.log(
DEV_LEVEL,
Expand Down

0 comments on commit 2e1f551

Please sign in to comment.