@@ -204,35 +204,37 @@ impl RedisCluster {
204
204
) ) ;
205
205
}
206
206
207
+ sleep ( Duration :: from_millis ( 100 ) ) ;
208
+
207
209
for server in servers. iter_mut ( ) {
208
210
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:?}.\n logfile: {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:?}.\n logfile: {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)
235
224
}
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
+ }
236
238
}
237
239
238
240
let mut cmd = process:: Command :: new ( "redis-cli" ) ;
0 commit comments