We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae325ba commit 3bc8322Copy full SHA for 3bc8322
asyncpg/connect_utils.py
@@ -905,8 +905,7 @@ async def can_be_used(connection):
905
is_in_hot_standby = await connection.fetchval(
906
"SELECT pg_catalog.pg_is_in_recovery()"
907
)
908
- connection_eligible = is_in_hot_standby == should_be_in_hot_standby
909
- return connection_eligible
+ return is_in_hot_standby == should_be_in_hot_standby
910
911
return can_be_used
912
@@ -919,8 +918,9 @@ async def can_be_used(connection):
919
918
settings = connection.get_settings()
920
is_readonly = getattr(settings, 'default_transaction_read_only', 'off')
921
922
- if should_be_read_only and is_readonly == "on":
923
- return True
+ if is_readonly == "on":
+ return should_be_read_only
+
924
return await _accept_in_hot_standby(should_be_read_only)(connection)
925
926
0 commit comments