Skip to content

Commit

Permalink
Merge branch 'optimistic-subscribe' of https://github.com/feywind/nod…
Browse files Browse the repository at this point in the history
…ejs-pubsub into optimistic-subscribe
  • Loading branch information
gcf-owl-bot[bot] committed Sep 17, 2024
2 parents 2744fa9 + a5c1931 commit 5e9e789
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import {grpc} from 'google-gax';

/**
* Represents a debug message the user might want to print out for logging
* while debugging or whatnot. These will always come by way of the 'error'
Expand All @@ -33,7 +31,6 @@ import {grpc} from 'google-gax';
export class DebugMessage {
constructor(
public message: string,
public error?: Error,
public status?: grpc.StatusObject
public error?: Error
) {}
}
8 changes: 4 additions & 4 deletions src/message-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,14 @@ export class MessageStream extends PassThrough {
private _onEnd(index: number, status: grpc.StatusObject): void {
this._removeStream(index);

const statusError = new StatusError(status);

if (PullRetry.retry(status)) {
this.emit(
'debug',
new DebugMessage(
`Subscriber stream ${index} has ended with status ${status.code}; will be retried.`,
undefined,
status
statusError
)
);
if (PullRetry.resetFailures(status)) {
Expand All @@ -404,8 +405,7 @@ export class MessageStream extends PassThrough {
'debug',
new DebugMessage(
`Subscriber stream ${index} has ended with status ${status.code}; will not be retried.`,
undefined,
status
statusError
)
);

Expand Down

0 comments on commit 5e9e789

Please sign in to comment.