fix(virtualstream): Fix keep-alive loop handling and test cleanup

This commit is contained in:
2024-09-06 13:46:09 +02:00
parent f461f16bfd
commit 4d98915dbd
4 changed files with 14 additions and 3 deletions

View File

@ -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.'
}

View File

@ -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();