Skip to content

Commit 222acd5

Browse files
VitaliyaIoffeylobankov
authored andcommitted
Use gevent sleep for switching context
`time.sleep` was changed to `gevent.sleep` to allow current greenlet to sleep and others to run. When `time.sleep` is used, greenlet's context is not changed from the main process to the test greenlet. As a result of this, there is no data received by the main process while hanging the tarantool server process and the test is fallen down by the common timeout (NO_OUTPUT_TIMEOUT). Moreover, the process is not killed by test-run. Using `gevent.sleep` makes the test fall down by the test timeout and kill the farantool server process. Part of #276
1 parent 2604c46 commit 222acd5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/tarantool_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def seek_wait(self, msg, proc=None, name=None):
448448
while True:
449449
if os.path.exists(self.path):
450450
break
451-
time.sleep(0.001)
451+
gevent.sleep(0.001)
452452

453453
with open(self.path, 'r') as f:
454454
f.seek(self.log_begin, os.SEEK_SET)
@@ -459,7 +459,7 @@ def seek_wait(self, msg, proc=None, name=None):
459459
raise TarantoolStartError(name)
460460
log_str = f.readline()
461461
if not log_str:
462-
time.sleep(0.001)
462+
gevent.sleep(0.001)
463463
f.seek(cur_pos, os.SEEK_SET)
464464
continue
465465
if re.findall(msg, log_str):
@@ -1123,7 +1123,7 @@ def wait_until_started(self, wait_load=True):
11231123
if e.errno == errno.ECONNREFUSED:
11241124
color_log(' | Connection refused; will retry every 0.1 '
11251125
'seconds...')
1126-
time.sleep(0.1)
1126+
gevent.sleep(0.1)
11271127
continue
11281128
raise
11291129

0 commit comments

Comments
 (0)