Verify the server has not set default_transaction_read_only=True
(should_be_read_only: bool)
| 1229 | |
| 1230 | |
| 1231 | def _accept_read_only(should_be_read_only: bool): |
| 1232 | """ |
| 1233 | Verify the server has not set default_transaction_read_only=True |
| 1234 | """ |
| 1235 | async def can_be_used(connection): |
| 1236 | settings = connection.get_settings() |
| 1237 | is_readonly = getattr(settings, 'default_transaction_read_only', 'off') |
| 1238 | |
| 1239 | if is_readonly == "on": |
| 1240 | return should_be_read_only |
| 1241 | |
| 1242 | return await _accept_in_hot_standby(should_be_read_only)(connection) |
| 1243 | return can_be_used |
| 1244 | |
| 1245 | |
| 1246 | async def _accept_any(_): |