Interrupt live traffic retry delays on stop
This commit is contained in:
@@ -223,6 +223,29 @@ for (const incompatible of [
|
||||
});
|
||||
}
|
||||
|
||||
test('collector stop interrupts an active retry delay', async () => {
|
||||
const service = createLiveTrafficService({
|
||||
port: 19091,
|
||||
enabled: true,
|
||||
isRuntimeRunning: () => true,
|
||||
clientFactory: () => ({
|
||||
async getVersion() { return { version: '1.13.18', apiVersion: 4 }; },
|
||||
async getStartedAt() { throw new Error('must not start'); },
|
||||
subscribeConnections() { throw new Error('must not subscribe'); },
|
||||
subscribeStatus() { throw new Error('must not subscribe'); },
|
||||
}),
|
||||
});
|
||||
|
||||
service.start();
|
||||
await waitFor(() => service.snapshot().source.state === 'incompatible');
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
const stoppedBeforeNextTurn = await Promise.race([
|
||||
service.stop().then(() => true),
|
||||
new Promise((resolve) => setImmediate(() => resolve(false))),
|
||||
]);
|
||||
assert.equal(stoppedBeforeNextTurn, true);
|
||||
});
|
||||
|
||||
test('collector reconnects when either RC5 stream ends and cancels its sibling', async () => {
|
||||
let factoryCalls = 0;
|
||||
let authorizationCalls = 0;
|
||||
|
||||
Reference in New Issue
Block a user