Skip to content
Snippets Groups Projects
Commit 28ccaf4d authored by Dmitry Shelepnev's avatar Dmitry Shelepnev
Browse files

Add check connection in check_settings job (sopds_scanner)

parent 1a902824
Branches
Tags
No related merge requests found
...@@ -66,9 +66,6 @@ class Command(BaseCommand): ...@@ -66,9 +66,6 @@ class Command(BaseCommand):
def scan(self): def scan(self):
if connection.connection and not connection.is_usable(): if connection.connection and not connection.is_usable():
# destroy the default mysql connection
# after this line, when you use ORM methods
# django will reconnect to the default mysql
del(connections._connections.default) del(connections._connections.default)
scanner=opdsScanner(self.logger) scanner=opdsScanner(self.logger)
...@@ -85,6 +82,8 @@ class Command(BaseCommand): ...@@ -85,6 +82,8 @@ class Command(BaseCommand):
self.sched.reschedule_job('scan', trigger='cron', day=self.SCAN_SHED_DAY, day_of_week=self.SCAN_SHED_DOW, hour=self.SCAN_SHED_HOUR, minute=self.SCAN_SHED_MIN) self.sched.reschedule_job('scan', trigger='cron', day=self.SCAN_SHED_DAY, day_of_week=self.SCAN_SHED_DOW, hour=self.SCAN_SHED_HOUR, minute=self.SCAN_SHED_MIN)
def check_settings(self): def check_settings(self):
if connection.connection and not connection.is_usable():
del(connections._connections.default)
settings.constance_update_all() settings.constance_update_all()
if self.SCAN_SHED_MIN==config.SOPDS_SCAN_SHED_MIN and \ if self.SCAN_SHED_MIN==config.SOPDS_SCAN_SHED_MIN and \
self.SCAN_SHED_HOUR==config.SOPDS_SCAN_SHED_HOUR and \ self.SCAN_SHED_HOUR==config.SOPDS_SCAN_SHED_HOUR and \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment