[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rework low level message stream retries, add debugging #1713

Merged
merged 6 commits into from
Apr 16, 2023
Merged
Prev Previous commit
Next Next commit
feat: add debug logging from the low level message stream for reconnects
  • Loading branch information
feywind committed Apr 15, 2023
commit fc364b791578ac6014db746cf275eabbe664d7ad
13 changes: 13 additions & 0 deletions src/message-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,26 @@ export class MessageStream extends PassThrough {
this._removeStream(index);

if (PullRetry.retry(status)) {
this.emit(
'debug',
new Error(
feywind marked this conversation as resolved.
Show resolved Hide resolved
`Subscriber stream ${index} has ended with status ${status.code}; will be retried.`
)
);
if (PullRetry.resetFailures(status)) {
this._retrier.reset(this._streams[index]);
}
this._retrier.retryLater(this._streams[index], () => {
this._fillStreamPool();
feywind marked this conversation as resolved.
Show resolved Hide resolved
});
} else if (this._activeStreams() === 0) {
this.emit(
'debug',
new Error(
`Subscriber stream ${index} has ended with status ${status.code}; will not be retried.`
)
);

// No streams left, and nothing to retry.
this.destroy(new StatusError(status));
}
Expand Down