Skip to content
Snippets Groups Projects
Commit 2adeec7f authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[backend][local_scheduler] Close database connections before starting new process

This will avoid some concurrency problem especially with SQLite.

Related to the use of the multiprocessing module.

See:
https://code.djangoproject.com/ticket/20562
parent 0359a739
No related branches found
No related tags found
2 merge requests!2551.4.x,!240Improve db handling
Pipeline #
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
from django.conf import settings from django.conf import settings
from django import db
import multiprocessing import multiprocessing
import psutil import psutil
...@@ -94,6 +95,8 @@ def start_scheduler(settings_module='beat.web.settings.settings', interval=5, ...@@ -94,6 +95,8 @@ def start_scheduler(settings_module='beat.web.settings.settings', interval=5,
if getattr(settings, 'LOCAL_SCHEDULER_VERBOSITY', None) is not None: if getattr(settings, 'LOCAL_SCHEDULER_VERBOSITY', None) is not None:
args.append(settings.LOCAL_SCHEDULER_VERBOSITY) args.append(settings.LOCAL_SCHEDULER_VERBOSITY)
db.connections.close_all()
process = SchedulerProcess(args) process = SchedulerProcess(args)
process.start() process.start()
process.queue.get() process.queue.get()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment