Skip to content

Commit e72d149

Browse files
committed
Revert "fix: trigger reconnection on bridge read NotLeaderError"
This reverts commit 8b02d15.
1 parent 25045ba commit e72d149

File tree

3 files changed

+4
-46
lines changed

3 files changed

+4
-46
lines changed

packages/db-client/src/Client/index.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -692,36 +692,4 @@ export class Client {
692692
public get rustClient(): bridge.RustClient {
693693
return this.#rustClient;
694694
}
695-
696-
public handleBridgeError = async (error: Error): Promise<void> => {
697-
const [reconnect, nextEndpoint] = this.shouldReconnect(error);
698-
699-
if (!reconnect) return;
700-
701-
debug.connection("Got bridge reconnection error", error.message);
702-
703-
const currentChannel = await this.#channel;
704-
if (!currentChannel) {
705-
debug.connection("No channel to reconnect");
706-
return;
707-
}
708-
709-
debug.connection(
710-
`Reconnection required${nextEndpoint ? ` to: ${nextEndpoint}` : ""}`
711-
);
712-
713-
const [_protocol, address, port] = currentChannel.getTarget().split(":");
714-
715-
currentChannel.close();
716-
this.#grpcClients.clear();
717-
this.#channel = undefined;
718-
this.#serverFeatures = undefined;
719-
this.#nextChannelSettings = {
720-
failedEndpoint: {
721-
address,
722-
port: Number.parseInt(port),
723-
},
724-
nextEndpoint,
725-
};
726-
};
727695
}

packages/db-client/src/streams/readAll.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,9 @@ Client.prototype.readAll = function (
7878
try {
7979
stream = this.rustClient.readAll(options);
8080
} catch (error) {
81-
const bridgeError = convertBridgeError(error);
82-
this.handleBridgeError(bridgeError);
83-
throw bridgeError;
81+
throw convertBridgeError(error);
8482
}
8583

86-
const handleBridgeError = this.handleBridgeError;
8784
const convert = async function* (
8885
stream: AsyncIterable<bridge.ResolvedEvent[]>
8986
) {
@@ -94,9 +91,7 @@ Client.prototype.readAll = function (
9491
}
9592
}
9693
} catch (error) {
97-
const bridgeError = convertBridgeError(error);
98-
await handleBridgeError(bridgeError);
99-
throw bridgeError;
94+
throw convertBridgeError(error);
10095
}
10196
};
10297

packages/db-client/src/streams/readStream.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,9 @@ Client.prototype.readStream = function <
108108
try {
109109
stream = this.rustClient.readStream(streamName, options);
110110
} catch (error) {
111-
const bridgeError = convertBridgeError(error, streamName);
112-
this.handleBridgeError(bridgeError);
113-
throw bridgeError;
111+
throw convertBridgeError(error, streamName);
114112
}
115113

116-
const handleBridgeError = this.handleBridgeError;
117114
const convert = async function* (
118115
stream: AsyncIterable<bridge.ResolvedEvent[]>
119116
) {
@@ -124,9 +121,7 @@ Client.prototype.readStream = function <
124121
}
125122
}
126123
} catch (error) {
127-
const bridgeError = convertBridgeError(error, streamName);
128-
await handleBridgeError(bridgeError);
129-
throw bridgeError;
124+
throw convertBridgeError(error, streamName);
130125
}
131126
};
132127

0 commit comments

Comments
 (0)