summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
diff options
context:
space:
mode:
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/exit_handler.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/exit_handler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py b/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
index 69f2408f..f558f365 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
@@ -1,5 +1,5 @@
# ============LICENSE_START===================================================
-# Copyright (C) 2020-2022 Nordix Foundation.
+# Copyright (C) 2020-2023 Nordix Foundation.
# ============================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -49,7 +49,8 @@ class ExitHandler:
logger.info(f'Cancelling thread {thread.name}')
thread.cancel()
logger.info('Closing all DB connections')
- db.session.bind.dispose()
+ if db.session.bind is not None:
+ db.session.bind.dispose()
db.session.close()
db.engine.dispose()
ExitHandler.shutdown_signal_received = True