From a6bf78ed561f24d20818f15270b9c5c4e04912b3 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Thu, 8 Mar 2018 18:32:47 -0800 Subject: [PATCH] Check is schedulers running before shutdown --- plexpy/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 5c3e211a..0585961a 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -1621,8 +1621,11 @@ def upgrade(): def shutdown(restart=False, update=False, checkout=False): cherrypy.engine.exit() - SCHED.shutdown(wait=False) - activity_handler.ACTIVITY_SCHED.shutdown(wait=False) + + if SCHED.running: + SCHED.shutdown(wait=False) + if activity_handler.ACTIVITY_SCHED.running: + activity_handler.ACTIVITY_SCHED.shutdown(wait=False) # Stop the notification threads for i in range(CONFIG.NOTIFICATION_THREADS):