feat(gateway): add configurable lane queue mode, cap, and overflow

This commit is contained in:
William Valentin
2026-02-16 11:48:45 -08:00
parent 527602fd8a
commit f7284a4ef1
9 changed files with 178 additions and 5 deletions
+3 -1
View File
@@ -6,6 +6,7 @@ import { serveStatic } from './static.js';
import { SessionBridge } from './session-bridge.js';
import type { SessionBridgeConfig } from './session-bridge.js';
import { LaneQueue } from './lane-queue.js';
import type { LaneQueueConfig } from './lane-queue.js';
import { MetricsCollector } from './metrics.js';
import { authenticateRequest } from './auth.js';
import type { AuthConfig } from './auth.js';
@@ -84,6 +85,7 @@ export interface GatewayServerConfig {
maxViolations?: number;
violationWindowMs?: number;
};
queue?: Partial<LaneQueueConfig>;
/** Optional pairing manager for DM pairing code management via gateway. */
pairingManager?: PairingManager;
memoryStore?: MemoryStore;
@@ -143,7 +145,7 @@ export class GatewayServer {
memoryStore: config.memoryStore,
});
this.laneQueue = new LaneQueue();
this.laneQueue = new LaneQueue(config.queue);
this.metrics = new MetricsCollector({
getQueueDepth: () => this.laneQueue.totalPending(),
});