Reconnect only if reconnect is enabled
This commit is contained in:
parent
ae9a970782
commit
d83c731030
|
@ -1681,7 +1681,7 @@ def update_scheduledtasks():
|
||||||
schedule.end_scheduled_tasks()
|
schedule.end_scheduled_tasks()
|
||||||
|
|
||||||
# Re-register tasks with new settings
|
# Re-register tasks with new settings
|
||||||
schedule.register_scheduled_tasks()
|
schedule.register_scheduled_tasks(cli.reconnect_enable)
|
||||||
except IntegrityError as ex:
|
except IntegrityError as ex:
|
||||||
ub.session.rollback()
|
ub.session.rollback()
|
||||||
log.error("An unknown error occurred while saving scheduled tasks settings")
|
log.error("An unknown error occurred while saving scheduled tasks settings")
|
||||||
|
|
|
@ -51,7 +51,7 @@ def end_scheduled_tasks():
|
||||||
worker.end_task(task.id)
|
worker.end_task(task.id)
|
||||||
|
|
||||||
|
|
||||||
def register_scheduled_tasks():
|
def register_scheduled_tasks(reconnect=True):
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
|
|
||||||
if scheduler:
|
if scheduler:
|
||||||
|
@ -68,7 +68,7 @@ def register_scheduled_tasks():
|
||||||
|
|
||||||
# Kick-off tasks, if they should currently be running
|
# Kick-off tasks, if they should currently be running
|
||||||
if should_task_be_running(start, end):
|
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():
|
def register_startup_tasks():
|
||||||
|
|
|
@ -39,7 +39,7 @@ class TaskReconnectDatabase(CalibreTask):
|
||||||
urlopen('http://' + address + ':' + str(port) + '/reconnect')
|
urlopen('http://' + address + ':' + str(port) + '/reconnect')
|
||||||
self._handleSuccess()
|
self._handleSuccess()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self._handleError(u'Unable to reconnect Calibre database: ' + str(ex))
|
self._handleError('Unable to reconnect Calibre database: ' + str(ex))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user