fix(VirtualStream): Fix backpressure handling in VirtualStream workOnQueue method
This commit is contained in:
parent
c61e30fe64
commit
adff43c0e2
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-10-16 - 3.1.6 - fix(VirtualStream)
|
||||
Fix backpressure handling in VirtualStream workOnQueue method
|
||||
|
||||
- Resolved an issue in the workOnQueue method of VirtualStream where concurrent execution was not properly managed.
|
||||
- Introduced a workingDeferred promise to ensure proper queue handling and resolve potential race conditions.
|
||||
|
||||
## 2024-10-16 - 3.1.5 - fix(virtualstream)
|
||||
Add console log for debugging backpressure feedback loop
|
||||
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedrequest',
|
||||
version: '3.1.5',
|
||||
version: '3.1.6',
|
||||
description: 'A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.'
|
||||
}
|
||||
|
@ -143,10 +143,17 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
|
||||
|
||||
constructor() {}
|
||||
|
||||
workingDeferred: plugins.smartpromise.Deferred<void>;
|
||||
|
||||
/**
|
||||
* takes care of sending
|
||||
*/
|
||||
private async workOnQueue() {
|
||||
if (this.workingDeferred) {
|
||||
return this.workingDeferred.promise;
|
||||
} else {
|
||||
this.workingDeferred = plugins.smartpromise.defer();
|
||||
}
|
||||
if(this.side === 'requesting') {
|
||||
let thisSideIsBackpressured = !this.receiveBackpressuredArray.checkSpaceAvailable();
|
||||
let otherSideHasNext = false;
|
||||
@ -219,6 +226,8 @@ export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterf
|
||||
}
|
||||
|
||||
}
|
||||
this.workingDeferred.resolve();
|
||||
this.workingDeferred = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user