Skip to content

Commit 1267a1b

Browse files
committed
feat(background-agent): support 0 as unlimited concurrency
Setting concurrency to 0 means unlimited (Infinity). Works for defaultConcurrency, providerConcurrency, and modelConcurrency. 🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
1 parent a423a33 commit 1267a1b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/features/background-agent/concurrency.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,20 @@ export class ConcurrencyManager {
1010
}
1111

1212
getConcurrencyLimit(model: string): number {
13-
if (this.config?.modelConcurrency?.[model]) {
14-
return this.config.modelConcurrency[model]
13+
const modelLimit = this.config?.modelConcurrency?.[model]
14+
if (modelLimit !== undefined) {
15+
return modelLimit === 0 ? Infinity : modelLimit
1516
}
1617
const provider = model.split('/')[0]
17-
if (this.config?.providerConcurrency?.[provider]) {
18-
return this.config.providerConcurrency[provider]
18+
const providerLimit = this.config?.providerConcurrency?.[provider]
19+
if (providerLimit !== undefined) {
20+
return providerLimit === 0 ? Infinity : providerLimit
1921
}
20-
return this.config?.defaultConcurrency ?? 5
22+
const defaultLimit = this.config?.defaultConcurrency
23+
if (defaultLimit !== undefined) {
24+
return defaultLimit === 0 ? Infinity : defaultLimit
25+
}
26+
return 5
2127
}
2228

2329
async acquire(model: string): Promise<void> {

0 commit comments

Comments
 (0)