mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:08:27 +00:00
Gateway: bound agent run sequence tracking
This commit is contained in:
@@ -73,6 +73,7 @@ export function startGatewayMaintenanceTimers(params: {
|
||||
|
||||
// dedupe cache cleanup
|
||||
const dedupeCleanup = setInterval(() => {
|
||||
const AGENT_RUN_SEQ_MAX = 10_000;
|
||||
const now = Date.now();
|
||||
for (const [k, v] of params.dedupe) {
|
||||
if (now - v.ts > DEDUPE_TTL_MS) {
|
||||
@@ -86,6 +87,18 @@ export function startGatewayMaintenanceTimers(params: {
|
||||
}
|
||||
}
|
||||
|
||||
if (params.agentRunSeq.size > AGENT_RUN_SEQ_MAX) {
|
||||
const excess = params.agentRunSeq.size - AGENT_RUN_SEQ_MAX;
|
||||
let removed = 0;
|
||||
for (const runId of params.agentRunSeq.keys()) {
|
||||
params.agentRunSeq.delete(runId);
|
||||
removed += 1;
|
||||
if (removed >= excess) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const [runId, entry] of params.chatAbortControllers) {
|
||||
if (now <= entry.expiresAtMs) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user