Skip to content

Commit a0cfcb5

Browse files
committed
replicator: Add max_handshake_retries field
Signed-off-by: Piotr Jastrzebski <piotr@chiselstrike.com>
1 parent 4f72593 commit a0cfcb5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

libsql-replication/src/replicator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ pub struct Replicator<C, I> {
139139
injector: I,
140140
state: ReplicatorState,
141141
frames_synced: usize,
142+
max_handshake_retries: usize,
142143
}
143144

144145
const INJECTOR_BUFFER_CAPACITY: usize = 10;
@@ -185,6 +186,7 @@ where
185186
injector,
186187
state: ReplicatorState::NeedHandshake,
187188
frames_synced: 0,
189+
max_handshake_retries: HANDSHAKE_MAX_RETRIES,
188190
}
189191
}
190192

@@ -208,7 +210,7 @@ where
208210

209211
pub async fn try_perform_handshake(&mut self) -> Result<(), Error> {
210212
let mut error_printed = false;
211-
for _ in 0..HANDSHAKE_MAX_RETRIES {
213+
for _ in 0..self.max_handshake_retries {
212214
tracing::debug!("Attempting to perform handshake with primary.");
213215
match self.client.handshake().await {
214216
Ok(_) => {

0 commit comments

Comments
 (0)