Skip to content

Commit

Permalink
fix(worker): make numIdleProcesses work (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbsp authored Nov 4, 2024
1 parent 70773f9 commit d9273f2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/afraid-camels-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/agents": patch
---

make numIdleProcesses work
2 changes: 1 addition & 1 deletion agents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"typescript": "^5.0.0"
},
"dependencies": {
"@livekit/mutex": "^1.0.0",
"@livekit/mutex": "^1.1.0",
"@livekit/protocol": "^1.21.0",
"@livekit/rtc-node": "^0.11.0",
"commander": "^12.0.0",
Expand Down
8 changes: 4 additions & 4 deletions agents/src/ipc/proc_pool.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
//
// SPDX-License-Identifier: Apache-2.0
import { Mutex } from '@livekit/mutex';
import { MultiMutex, Mutex } from '@livekit/mutex';
import type { RunningJobInfo } from '../job.js';
import { Queue } from '../utils.js';
import type { JobExecutor } from './job_executor.js';
Expand All @@ -17,18 +17,18 @@ export class ProcPool {
closed = false;
controller = new AbortController();
initMutex = new Mutex();
procMutex: Mutex;
procMutex: MultiMutex;
procUnlock?: () => void;
warmedProcQueue = new Queue<JobExecutor>();

constructor(
agent: string,
_numIdleProcesses: number,
numIdleProcesses: number,
initializeTimeout: number,
closeTimeout: number,
) {
this.agent = agent;
this.procMutex = new Mutex();
this.procMutex = new MultiMutex(numIdleProcesses);
this.initializeTimeout = initializeTimeout;
this.closeTimeout = closeTimeout;
}
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d9273f2

Please sign in to comment.