Skip to content

Commit

Permalink
Update DB router (#4283)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimasciput authored Oct 3, 2024
1 parent 85a368a commit 364733b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bims/utils/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def db_for_read(self, model, **hints):
Reads go to a randomly-chosen replica.
"""
if settings.REPLICA_ENV_VAR:
chosen_replica_key = random.choice(
list(settings.DATABASES.keys())[1:])
return chosen_replica_key
available_databases = list(settings.DATABASES.keys())
chosen_db_key = random.choice(available_databases)
return chosen_db_key
else:
return PRIMARY

Expand Down

0 comments on commit 364733b

Please sign in to comment.