Skip to content

Commit

Permalink
PR #186 from rtokarev
Browse files Browse the repository at this point in the history
  • Loading branch information
avtikhon committed Nov 25, 2020
1 parent b7567a6 commit a5bd6da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/tarantool_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from gevent import socket
from greenlet import GreenletExit
from threading import Timer

try:
from cStringIO import StringIO
Expand Down Expand Up @@ -944,10 +945,14 @@ def kill_current_test(self):
if self.current_test.current_test_greenlet:
gevent.kill(self.current_test.current_test_greenlet)

def kill(self):
color_log('Kill process {0}\n'.format(self.process.pid))
self.process.kill()

def wait_stop(self):
self.process.wait()

def stop(self, silent=True, signal=signal.SIGTERM):
def stop(self, silent=True, signal=signal.SIGTERM, timeout=5):
""" Kill tarantool server using specified signal (SIGTERM by default)
signal - a number of a signal
Expand Down Expand Up @@ -980,9 +985,12 @@ def stop(self, silent=True, signal=signal.SIGTERM):
self.process.send_signal(signal)
except OSError:
pass
timer = Timer(timeout, lambda server: server.kill(), [self])
timer.start()
if self.crash_detector is not None:
save_join(self.crash_detector)
self.wait_stop()
timer.cancel()

self.status = None
if re.search(r'^/', str(self._admin.port)):
Expand Down

0 comments on commit a5bd6da

Please sign in to comment.