feat(gateway): support per-channel and per-session queue policy overrides

This commit is contained in:
William Valentin
2026-02-16 11:51:26 -08:00
parent f7284a4ef1
commit fbd24d4379
11 changed files with 181 additions and 9 deletions
+19
View File
@@ -248,4 +248,23 @@ describe('LaneQueue', () => {
await expect(p1).resolves.toBe('active');
await expect(p3).resolves.toBe('new-pending');
});
it('supports per-enqueue policy overrides', async () => {
const queue = new LaneQueue({ mode: 'collect', cap: 10, overflow: 'drop_old' });
let resolveFirst!: () => void;
const firstBlocks = new Promise<void>((r) => { resolveFirst = r; });
const p1 = queue.enqueue('lane-a', async () => {
await firstBlocks;
return 'active';
});
const p2 = queue.enqueue('lane-a', async () => 'old-pending', { mode: 'steer' });
const p3 = queue.enqueue('lane-a', async () => 'latest-pending', { mode: 'steer' });
await expect(p2).rejects.toThrow('Superseded by newer request');
resolveFirst();
await expect(p1).resolves.toBe('active');
await expect(p3).resolves.toBe('latest-pending');
});
});