fix(virtualstream): Fix handling of virtual streams for proper shutdown

This commit is contained in:
2024-10-14 00:13:28 +02:00
parent 03c7150b6b
commit 7b6fb9e9bc
5 changed files with 250 additions and 184 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedrequest',
version: '3.1.0',
version: '3.1.1',
description: 'A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.'
}

View File

@ -380,7 +380,7 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
public async writeToWebstream(writableStreamArg: WritableStream<T>) {
const writer = writableStreamArg.getWriter();
while(this.keepAlive) {
while(this.keepAlive || this.receiveBackpressuredArray.checkHasItems()) {
await writer.write(await this.fetchData());
}
}