From 429db5b7d457ff58c555afe31961f1d6d221ee41 Mon Sep 17 00:00:00 2001 From: echel0n Date: Wed, 30 Jul 2014 18:57:31 -0700 Subject: [PATCH] Shutdown/restarts now wait for Tornado to finish shutting down before proceeding further --- SickBeard.py | 6 +++++- sickbeard/webserveInit.py | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/SickBeard.py b/SickBeard.py index 204fff63..1e943be0 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -482,8 +482,12 @@ class SickRage(object): # shutdown web server if self.webserver: + logger.log("Shutting down Tornado") self.webserver.shutDown() - self.webserver = None + try: + self.webserver.join(10) + except: + pass # if run as daemon delete the pidfile if self.runAsDaemon and self.CREATEPID: diff --git a/sickbeard/webserveInit.py b/sickbeard/webserveInit.py index edd48a81..567ce865 100644 --- a/sickbeard/webserveInit.py +++ b/sickbeard/webserveInit.py @@ -150,7 +150,5 @@ class SRWebServer(threading.Thread): def shutDown(self): self.alive = False if self.server: - logger.log("Shutting down tornado") self.server.stop() - self.io_loop.stop() - self.join() \ No newline at end of file + self.io_loop.stop() \ No newline at end of file