Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions livekit-agents/livekit/agents/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def __init__(
self,
*,
job: agent.Job,
on_reject: Callable[[bool], Coroutine[None, None, None]],
on_reject: Callable[[], Coroutine[None, None, None]],
on_accept: Callable[[JobAcceptArguments], Coroutine[None, None, None]],
) -> None:
self._job = job
Expand Down Expand Up @@ -523,8 +523,8 @@ def agent_name(self) -> str:
return self._job.agent_name

async def reject(self) -> None:
"""Reject the job request. The job will not be assigned to another worker"""
await self._on_reject(True)
"""Reject the job request. The job may be assigned to another worker"""
await self._on_reject()

async def accept(
self,
Expand Down
3 changes: 1 addition & 2 deletions livekit-agents/livekit/agents/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,14 +820,13 @@ async def _answer_availability(self, msg: agent.AvailabilityRequest) -> None:

answered = False

async def _on_reject(terminate: bool = False) -> None:
async def _on_reject() -> None:
nonlocal answered
answered = True

availability_resp = agent.WorkerMessage()
availability_resp.availability.job_id = msg.job.id
availability_resp.availability.available = False
availability_resp.availability.terminate = terminate
await self._queue_msg(availability_resp)

async def _on_accept(args: JobAcceptArguments) -> None:
Expand Down
Loading