refactor: optimize core engine and retrieval logic for v2.80.43
This commit is contained in:
+19
-3
@@ -1,8 +1,24 @@
|
||||
import * as os from 'os';
|
||||
import { logInfo, logError } from '../utils';
|
||||
|
||||
/**
|
||||
* ActionQueueManager: Manages large-scale tasks by processing them
|
||||
* with a concurrency limit to prevent resource exhaustion and I/O bottlenecks
|
||||
* Default concurrency = max(2, cpus - 1). Leaves one core for the VS Code UI
|
||||
* thread and the extension host, scales up on bigger boxes. Static per-process
|
||||
* (no dynamic adjustment) — kept simple because the heavy work (LLM calls)
|
||||
* is gated by `missionId` locks elsewhere, not the action queue.
|
||||
*/
|
||||
function defaultConcurrencyLimit(): number {
|
||||
try {
|
||||
const cpus = os.cpus()?.length ?? 4;
|
||||
return Math.max(2, cpus - 1);
|
||||
} catch {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ActionQueueManager: Manages large-scale tasks by processing them
|
||||
* with a concurrency limit to prevent resource exhaustion and I/O bottlenecks
|
||||
* while maintaining high throughput under maximum load.
|
||||
*/
|
||||
export class ActionQueueManager {
|
||||
@@ -10,7 +26,7 @@ export class ActionQueueManager {
|
||||
private activeCount: number = 0;
|
||||
private readonly concurrencyLimit: number;
|
||||
|
||||
constructor(concurrencyLimit: number = 3) {
|
||||
constructor(concurrencyLimit: number = defaultConcurrencyLimit()) {
|
||||
this.concurrencyLimit = concurrencyLimit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user