fix(virtualstream): Fix keep-alive loop handling and test cleanup
This commit is contained in:
parent
f461f16bfd
commit
4d98915dbd
@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-09-06 - 3.0.32 - fix(virtualstream)
|
||||
Fix keep-alive loop handling and test cleanup
|
||||
|
||||
- Prevent unnecessary keep-alive loop from starting on the responding side
|
||||
- Add logging for keep-alive loop initiation in VirtualStream
|
||||
- Temporarily comment out stream close and tap forceful stop in test to avoid abrupt termination
|
||||
|
||||
## 2024-09-06 - 3.0.31 - fix(core)
|
||||
Updated dependencies and added close method to VirtualStream
|
||||
|
||||
|
@ -98,13 +98,13 @@ tap.test('should allow VirtualStreams', async () => {
|
||||
const data = await generatedRequestingVS.fetchData();
|
||||
const decodedData = new TextDecoder().decode(data);
|
||||
expect(decodedData).toEqual('hello');
|
||||
newRequestingVS.close();
|
||||
// await newRequestingVS.close();
|
||||
});
|
||||
|
||||
tap.test('should end the server', async (toolsArg) => {
|
||||
await toolsArg.delayFor(1000);
|
||||
await testServer.stop();
|
||||
await tap.stopForcefully();
|
||||
// await tap.stopForcefully();
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedrequest',
|
||||
version: '3.0.31',
|
||||
version: '3.0.32',
|
||||
description: 'A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.'
|
||||
}
|
||||
|
@ -295,7 +295,11 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
|
||||
*/
|
||||
private async startKeepAliveLoop() {
|
||||
// initially wait for a second
|
||||
if (this.side === 'responding') {
|
||||
return;
|
||||
}
|
||||
await plugins.smartdelay.delayFor(0);
|
||||
console.log(`starting keepalive loop on side ${this.side}`);
|
||||
let counter = 0;
|
||||
keepAliveLoop: while (this.keepAlive) {
|
||||
await this.triggerKeepAlive();
|
||||
|
Loading…
Reference in New Issue
Block a user