Reconnect only if reconnect is enabled

This commit is contained in:
Ozzie Isaacs 2022-04-25 08:28:29 +02:00
parent ae9a970782
commit d83c731030
3 changed files with 4 additions and 4 deletions

View File

@ -1681,7 +1681,7 @@ def update_scheduledtasks():
schedule.end_scheduled_tasks()
# Re-register tasks with new settings
schedule.register_scheduled_tasks()
schedule.register_scheduled_tasks(cli.reconnect_enable)
except IntegrityError as ex:
ub.session.rollback()
log.error("An unknown error occurred while saving scheduled tasks settings")

View File

@ -51,7 +51,7 @@ def end_scheduled_tasks():
worker.end_task(task.id)
def register_scheduled_tasks():
def register_scheduled_tasks(reconnect=True):
scheduler = BackgroundScheduler()
if scheduler:
@ -68,7 +68,7 @@ def register_scheduled_tasks():
# Kick-off tasks, if they should currently be running
if should_task_be_running(start, end):
scheduler.schedule_tasks_immediately(tasks=get_scheduled_tasks(False))
scheduler.schedule_tasks_immediately(tasks=get_scheduled_tasks(reconnect))
def register_startup_tasks():

View File

@ -39,7 +39,7 @@ class TaskReconnectDatabase(CalibreTask):
urlopen('http://' + address + ':' + str(port) + '/reconnect')
self._handleSuccess()
except Exception as ex:
self._handleError(u'Unable to reconnect Calibre database: ' + str(ex))
self._handleError('Unable to reconnect Calibre database: ' + str(ex))
@property
def name(self):