mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Prevent simultaneous importing of database/config
This commit is contained in:
parent
9095fc0c7a
commit
c814f219a2
2 changed files with 12 additions and 0 deletions
|
@ -214,6 +214,8 @@ def set_is_importing(value):
|
|||
def set_import_thread(config=None, backup=False):
|
||||
global IMPORT_THREAD
|
||||
if config:
|
||||
if IMPORT_THREAD:
|
||||
return
|
||||
IMPORT_THREAD = threading.Thread(target=import_tautulli_config,
|
||||
kwargs={'config': config, 'backup': backup})
|
||||
else:
|
||||
|
@ -221,6 +223,11 @@ def set_import_thread(config=None, backup=False):
|
|||
|
||||
|
||||
def import_tautulli_config(config=None, backup=False):
|
||||
if IS_IMPORTING:
|
||||
logger.warn("Tautulli Config :: Another Tautulli config is currently being imported. "
|
||||
"Please wait until it is complete before importing another config.")
|
||||
return False
|
||||
|
||||
if backup:
|
||||
# Make a backup of the current config first
|
||||
logger.info("Tautulli Config :: Creating a config backup before importing.")
|
||||
|
|
|
@ -68,6 +68,11 @@ def validate_database(database=None):
|
|||
|
||||
|
||||
def import_tautulli_db(database=None, method=None, backup=False):
|
||||
if IS_IMPORTING:
|
||||
logger.warn("Tautulli Database :: Another Tautulli database is currently being imported. "
|
||||
"Please wait until it is complete before importing another database.")
|
||||
return False
|
||||
|
||||
db_validate = validate_database(database=database)
|
||||
if not db_validate == 'success':
|
||||
logger.error("Tautulli Database :: Failed to import Tautulli database: %s", db_validate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue