fix(pi): strengthen final release proof
This commit is contained in:
@@ -98,6 +98,9 @@ class FifoSemaphore {
|
||||
}
|
||||
}
|
||||
|
||||
get activeCount(): number { return this.active; }
|
||||
get waitingCount(): number { return this.waiters.length; }
|
||||
|
||||
acquire(signal: AbortSignal): Promise<() => void> {
|
||||
if (signal.aborted) return Promise.reject(new PiSubagentChildError('SUBAGENT_ABORTED'));
|
||||
if (this.active < this.maximum) return Promise.resolve(this.issuePermit());
|
||||
@@ -292,6 +295,20 @@ export class PiSubagentScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
getDiagnostics(): {
|
||||
activeChildPermits: number;
|
||||
waitingChildPermits: number;
|
||||
activeDispatches: number;
|
||||
activeParents: number;
|
||||
} {
|
||||
return {
|
||||
activeChildPermits: this.childPermits.activeCount,
|
||||
waitingChildPermits: this.childPermits.waitingCount,
|
||||
activeDispatches: this.dispatches.size,
|
||||
activeParents: this.parentDispatches.size,
|
||||
};
|
||||
}
|
||||
|
||||
async close(): Promise<void> {
|
||||
if (this.closing) {
|
||||
await Promise.allSettled([...this.dispatches.values()].map((record) => record.flight));
|
||||
|
||||
Reference in New Issue
Block a user