Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix little logical error
  • Loading branch information
Jesse De Loore committed Dec 16, 2022
commit c3133c04c9cc1b0cbe0805a42331f56eddc98f0c
17 changes: 5 additions & 12 deletions asyncpg/connect_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,18 +917,11 @@ def _accept_read_only(should_be_read_only: bool):
"""
async def can_be_used(connection):
settings = connection.get_settings()
is_read_only = getattr(settings, 'default_transaction_read_only', None)
if is_read_only is not None:
is_read_only = is_read_only == "on"
else:
is_read_only = False
if should_be_read_only:
if is_read_only:
return True
elif await _accept_in_hot_standby(True)(connection):
return True
return False
return _accept_in_hot_standby(False)(connection)
is_read_only = getattr(settings, 'default_transaction_read_only', 'off')

if should_be_read_only and is_read_only == "on":
return True
return await _accept_in_hot_standby(should_be_read_only)(connection)
return can_be_used


Expand Down