Skip to content

Commit

Permalink
Use gevent sleep for switching context
Browse files Browse the repository at this point in the history
Was changed `time.sleep` to `gevent.sleep` to allow current greenlet to
sleep and others to run. If it uses time.sleep() greenlet's context is
not changed from the main process to test greenlet. As a result, there
was no data received by the main process during hanging tarantool and
the suite was fallen down by common timeout (no output timeout). Using
greenlet timeout allows to fall down by test timeout.

Fixes: #276
  • Loading branch information
VitaliyaIoffe committed May 21, 2021
1 parent fbc4001 commit a03704d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tarantool_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def seek_wait(self, msg, proc=None, name=None):
while True:
if os.path.exists(self.path):
break
time.sleep(0.001)
gevent.sleep(0.001)

with open(self.path, 'r') as f:
f.seek(self.log_begin, os.SEEK_SET)
Expand All @@ -460,7 +460,7 @@ def seek_wait(self, msg, proc=None, name=None):
raise TarantoolStartError(name)
log_str = f.readline()
if not log_str:
time.sleep(0.001)
gevent.sleep(0.001)
f.seek(cur_pos, os.SEEK_SET)
continue
if re.findall(msg, log_str):
Expand Down

0 comments on commit a03704d

Please sign in to comment.