Download src/acp/control-plane/session-actor-queue.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 702 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/acp/control-plane/session-actor-queue.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/acp/control-plane/session-actor-queue.ts
-
curl -L -o session-actor-queue.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/acp/control-plane/session-actor-queue.ts
702 Bytes
| import { KeyedAsyncQueue } from "../../plugin-sdk/keyed-async-queue.js"; | |
| /** Per-session async queue that serializes ACP runtime operations and exposes queue depth. */ | |
| export class SessionActorQueue { | |
| private readonly queue = new KeyedAsyncQueue(); | |
| private pendingCount = 0; | |
| getTotalPendingCount(): number { | |
| return this.pendingCount; | |
| } | |
| async run<T>(actorKey: string, op: () => Promise<T>): Promise<T> { | |
| return this.queue.enqueue(actorKey, op, { | |
| onEnqueue: () => { | |
| this.pendingCount += 1; | |
| }, | |
| onSettle: () => { | |
| // Keep queue-depth accounting symmetric with enqueue even when operations reject. | |
| this.pendingCount -= 1; | |
| }, | |
| }); | |
| } | |
| } | |