Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix default db setup to replica. (#12027)

Piotr Zabieglikd5640b9d4cee
diff --git a/saleor/graphql/core/context.py b/saleor/graphql/core/context.py
index f54e4af4ec..0afb3974d6 100644
--- a/saleor/graphql/core/context.py
+++ b/saleor/graphql/core/context.py
@@ -47,7 +47,7 @@ def get_database_connection_name(context: SaleorContext) -> str:
Queryset to main database: `User.objects.all()`.
Queryset to read replica: `User.objects.using(connection_name).all()`.
"""
- allow_replica = getattr(context, "allow_replica", False)
+ allow_replica = getattr(context, "allow_replica", True)
if allow_replica:
return settings.DATABASE_CONNECTION_REPLICA_NAME
return settings.DATABASE_CONNECTION_DEFAULT_NAME