Skip to content

Commit ac82ed7

Browse files
committed
minor fixes
1 parent a7d271b commit ac82ed7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/remote-config/src/client/realtime_handler.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,15 @@ export class RealtimeHandler {
152152
}
153153
this.isClosingConnection = true;
154154

155-
if (this.reader) {
156-
await this.reader.cancel();
155+
try {
156+
if (this.reader) {
157+
await this.reader.cancel();
158+
}
159+
} catch (e) {
160+
// The network connection was lost, so cancel() failed.
161+
// This is expected in a disconnected state, so we can safely ignore the error.
162+
this.logger.debug('Failed to cancel the reader, connection is gone.');
163+
} finally {
157164
this.reader = undefined;
158165
}
159166

@@ -444,7 +451,7 @@ export class RealtimeHandler {
444451
* invalid messages or when real-time updates are disabled.
445452
*/
446453
private async handleNotifications(
447-
reader: ReadableStreamDefaultReader
454+
reader: ReadableStreamDefaultReader<Uint8Array>
448455
): Promise<void> {
449456
if (reader == null) {
450457
return;

0 commit comments

Comments
 (0)