Skip to content

Commit 3bc8322

Browse files
author
Jesse De Loore
committed
fix logic issue
1 parent ae325ba commit 3bc8322

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

asyncpg/connect_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,7 @@ async def can_be_used(connection):
905905
is_in_hot_standby = await connection.fetchval(
906906
"SELECT pg_catalog.pg_is_in_recovery()"
907907
)
908-
connection_eligible = is_in_hot_standby == should_be_in_hot_standby
909-
return connection_eligible
908+
return is_in_hot_standby == should_be_in_hot_standby
910909

911910
return can_be_used
912911

@@ -919,8 +918,9 @@ async def can_be_used(connection):
919918
settings = connection.get_settings()
920919
is_readonly = getattr(settings, 'default_transaction_read_only', 'off')
921920

922-
if should_be_read_only and is_readonly == "on":
923-
return True
921+
if is_readonly == "on":
922+
return should_be_read_only
923+
924924
return await _accept_in_hot_standby(should_be_read_only)(connection)
925925
return can_be_used
926926

0 commit comments

Comments
 (0)