Skip to content

Commit

Permalink
Merge pull request #3 from parkpow/rm-has-replica
Browse files Browse the repository at this point in the history
refactor: fix checking for Schedules in different database
  • Loading branch information
jnoortheen authored Jun 5, 2024
2 parents 1b010f5 + baa478c commit 33359c6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions django_q/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ def scheduler(broker: Broker = None):
broker = get_broker()
close_old_django_connections()
try:
database_to_use = {"using": Conf.ORM} if not Conf.HAS_REPLICA else {}
with db.transaction.atomic(**database_to_use):
with db.transaction.atomic(using=db.router.db_for_write(Schedule)):
for s in (
Schedule.objects.select_for_update()
.exclude(repeats=0)
Expand Down

0 comments on commit 33359c6

Please sign in to comment.