Skip to content

Commit ae494e2

Browse files
committed
make restart.py prod tool more robust when luceneserver.log isn't written yet
1 parent 84769d7 commit ae494e2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

examples/githubsearch/production/restart.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ def run(cmd):
8383
run(f'nohup {localconstants.PYTHON_EXE} -u runServer.py > {localconstants.GLOBAL_LOG_DIR}/luceneserver.log 2>&1 &')
8484

8585
# Wait until server is really ready:
86+
server_log_file = f'{localconstants.GLOBAL_LOG_DIR}/luceneserver.log'
8687
while True:
87-
s = open('%s/luceneserver.log' % localconstants.GLOBAL_LOG_DIR, 'rb').read()
88-
if s.find(('listening on').encode('utf-8')) != -1:
89-
break
88+
if os.path.exists(server_log_file):
89+
s = open(server_log_file, 'rb').read()
90+
if s.find(('listening on').encode('utf-8')) != -1:
91+
break
9092
time.sleep(1.0)
9193

9294
print()

0 commit comments

Comments
 (0)