Skip to content

Commit 2503005

Browse files
committed
temp
1 parent faebe8f commit 2503005

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

redis/tests/support/cluster.rs

+28-26
Original file line numberDiff line numberDiff line change
@@ -204,35 +204,37 @@ impl RedisCluster {
204204
));
205205
}
206206

207+
sleep(Duration::from_millis(100));
208+
207209
for server in servers.iter_mut() {
208210
let process = &mut server.process;
209-
sleep(Duration::from_millis(50));
210-
match process.try_wait() {
211-
Ok(Some(status)) => {
212-
let contents = std::fs::read_to_string(server.log_file.clone()).unwrap();
213-
panic!("redis server creation failed with status {status:?}.\nlogfile: {contents}");
214-
}
215-
Ok(None) => {
216-
// wait for 10 seconds for the server to be available.
217-
let max_attempts = 200;
218-
let mut cur_attempts = 0;
219-
let addr = &server.addr;
220-
loop {
221-
if cur_attempts == max_attempts {
222-
panic!("redis server creation failed: Port {} closed", &addr)
223-
}
224-
if port_in_use(&addr.to_string()) {
225-
continue;
226-
}
227-
eprintln!("Waiting for redis process to initialize");
228-
sleep(Duration::from_millis(50));
229-
cur_attempts += 1;
230-
}
231-
}
232-
Err(e) => {
233-
panic!("Unexpected error in redis server creation {e}");
234-
}
211+
match process.try_wait() {
212+
Ok(Some(status)) => {
213+
let contents = std::fs::read_to_string(server.log_file.clone()).unwrap();
214+
panic!("redis server creation failed with status {status:?}.\nlogfile: {contents}");
215+
}
216+
Ok(None) => {
217+
// wait for 10 seconds for the server to be available.
218+
let max_attempts = 200;
219+
let mut cur_attempts = 0;
220+
let addr = &server.addr;
221+
loop {
222+
if cur_attempts == max_attempts {
223+
panic!("redis server creation failed: Port {} closed", &addr)
235224
}
225+
if port_in_use(&addr.to_string()) {
226+
break;
227+
}
228+
eprintln!("Waiting for redis process to initialize");
229+
sleep(Duration::from_millis(50));
230+
cur_attempts += 1;
231+
}
232+
continue;
233+
}
234+
Err(e) => {
235+
panic!("Unexpected error in redis server creation {e}");
236+
}
237+
}
236238
}
237239

238240
let mut cmd = process::Command::new("redis-cli");

0 commit comments

Comments
 (0)