File tree 3 files changed +12
-13
lines changed 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,5 @@ box.cfg{
19
19
pid_file = " box.pid" ,
20
20
auth_type = (auth_type :len () > 0 ) and auth_type or nil ,
21
21
}
22
+
23
+ rawset (_G , ' ready' , true )
Original file line number Diff line number Diff line change @@ -91,3 +91,5 @@ if crud_imported == false or vshard_imported == false then
91
91
else
92
92
configure_crud_instance (primary_listen , crud , vshard )
93
93
end
94
+
95
+ rawset (_G , ' ready' , true )
Original file line number Diff line number Diff line change @@ -302,27 +302,22 @@ def prepare_args(self):
302
302
303
303
return shlex .split (self .binary if not self .script else self .script_dst )
304
304
305
- def wait_until_started (self ):
305
+ def wait_until_ready (self ):
306
306
"""
307
- Wait until server is started .
307
+ Wait until server is configured and ready to work .
308
308
309
309
Server consists of two parts:
310
310
1) wait until server is listening on sockets
311
- 2) wait until server tells us his status
311
+ 2) wait until server finishes executing its script
312
312
"""
313
313
314
314
while True :
315
315
try :
316
316
temp = TarantoolAdmin ('0.0.0.0' , self .args ['admin' ])
317
- while True :
318
- ans = temp ('box.info.status' )[0 ]
319
- if ans in ('running' , 'hot_standby' , 'orphan' ) or ans .startswith ('replica' ):
320
- temp .disconnect ()
321
- return True
322
- if ans in ('loading' ,):
323
- continue
324
-
325
- raise ValueError (f"Strange output for `box.info.status`: { ans } " )
317
+ ans = temp ('ready' )[0 ]
318
+ temp .disconnect ()
319
+ if isinstance (ans , bool ) and ans :
320
+ return True
326
321
except socket .error as exc :
327
322
if exc .errno == errno .ECONNREFUSED :
328
323
time .sleep (0.1 )
@@ -352,7 +347,7 @@ def start(self):
352
347
cwd = self .vardir ,
353
348
stdout = self .log_des ,
354
349
stderr = self .log_des )
355
- self .wait_until_started ()
350
+ self .wait_until_ready ()
356
351
357
352
def stop (self ):
358
353
"""
You can’t perform that action at this time.
0 commit comments