File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,5 @@ box.cfg{
1919 pid_file = " box.pid" ,
2020 auth_type = (auth_type :len () > 0 ) and auth_type or nil ,
2121}
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
9191else
9292 configure_crud_instance (primary_listen , crud , vshard )
9393end
94+
95+ rawset (_G , ' ready' , true )
Original file line number Diff line number Diff line change @@ -302,27 +302,22 @@ def prepare_args(self):
302302
303303 return shlex .split (self .binary if not self .script else self .script_dst )
304304
305- def wait_until_started (self ):
305+ def wait_until_ready (self ):
306306 """
307- Wait until server is started .
307+ Wait until server is configured and ready to work .
308308
309309 Server consists of two parts:
310310 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
312312 """
313313
314314 while True :
315315 try :
316316 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
326321 except socket .error as exc :
327322 if exc .errno == errno .ECONNREFUSED :
328323 time .sleep (0.1 )
@@ -352,7 +347,7 @@ def start(self):
352347 cwd = self .vardir ,
353348 stdout = self .log_des ,
354349 stderr = self .log_des )
355- self .wait_until_started ()
350+ self .wait_until_ready ()
356351
357352 def stop (self ):
358353 """
You can’t perform that action at this time.
0 commit comments