Verify the server has not set default_transaction_read_only=True
(should_be_read_only: bool)
| 1169 | |
| 1170 | |
| 1171 | def _accept_read_only(should_be_read_only: bool): |
| 1172 | """ |
| 1173 | Verify the server has not set default_transaction_read_only=True |
| 1174 | """ |
| 1175 | async def can_be_used(connection): |
| 1176 | settings = connection.get_settings() |
| 1177 | is_readonly = getattr(settings, 'default_transaction_read_only', 'off') |
| 1178 | |
| 1179 | if is_readonly == "on": |
| 1180 | return should_be_read_only |
| 1181 | |
| 1182 | return await _accept_in_hot_standby(should_be_read_only)(connection) |
| 1183 | return can_be_used |
| 1184 | |
| 1185 | |
| 1186 | async def _accept_any(_): |
no outgoing calls
no test coverage detected
searching dependent graphs…