From 33a28d20a301ffece608e950a485b32f662f39d4 Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 30 Jun 2014 02:38:07 -0700 Subject: [PATCH] Cleanup leftover fd sockets on restart --- SickBeard.py | 7 +------ sickbeard/__init__.py | 11 +++++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/SickBeard.py b/SickBeard.py index 255445e5..59cc9b75 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -53,25 +53,20 @@ import threading import signal import traceback import getopt -import time import sickbeard -import tornado.ioloop -import tornado.autoreload - from sickbeard import db from sickbeard.tv import TVShow from sickbeard import logger from sickbeard import webserveInit -from sickbeard import autoreload_shutdown from sickbeard.version import SICKBEARD_VERSION from sickbeard.databases.mainDB import MIN_DB_VERSION from sickbeard.databases.mainDB import MAX_DB_VERSION from lib.configobj import ConfigObj -from tornado.ioloop import IOLoop, PeriodicCallback +from tornado.ioloop import IOLoop signal.signal(signal.SIGINT, sickbeard.sig_handler) signal.signal(signal.SIGTERM, sickbeard.sig_handler) diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index cb03674b..7eec8f2e 100644 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -1300,17 +1300,16 @@ def saveAll(): logger.log(u"Saving config file to disk") save_config() -def cleanup_tornado_sockets(io_loop): - for fd in io_loop._handlers.keys(): +def saveAndShutdown(): + halt() + saveAll() + + for fd in IOLoop.current()._handlers.keys(): try: os.close(fd) except Exception: pass -def saveAndShutdown(): - halt() - saveAll() - def invoke_command(to_call, *args, **kwargs): def delegate():