Lock the Scheduler model for the database it's using

This can happen when you use a database router for example
This commit is contained in:
Martijn Jacobs
2020-05-01 17:30:19 +02:00
parent 85a9f33ac0
commit f0546bc91c
+1 -1
View File
@@ -546,7 +546,7 @@ def scheduler(broker=None):
broker = get_broker()
close_old_django_connections()
try:
with db.transaction.atomic():
with db.transaction.atomic(using=Schedule.objects.db):
for s in (
Schedule.objects.select_for_update()
.exclude(repeats=0)