(fn, context, cursor, statement, *arg, **kw)
| 1563 | retry_interval = 0.5 |
| 1564 | |
| 1565 | def _run_with_retries(fn, context, cursor, statement, *arg, **kw): |
| 1566 | for retry in range(num_retries + 1): |
| 1567 | try: |
| 1568 | fn(cursor, statement, context=context, *arg) |
| 1569 | except engine.dialect.dbapi.Error as raw_dbapi_err: |
| 1570 | connection = context.root_connection |
| 1571 | if engine.dialect.is_disconnect( |
| 1572 | raw_dbapi_err, connection, cursor |
| 1573 | ): |
| 1574 | if retry > num_retries: |
| 1575 | raise |
| 1576 | engine.logger.error( |
| 1577 | "disconnection error, retrying operation", |
| 1578 | exc_info=True, |
| 1579 | ) |
| 1580 | connection.invalidate() |
| 1581 | |
| 1582 | connection.rollback() |
| 1583 | |
| 1584 | time.sleep(retry_interval) |
| 1585 | context.cursor = cursor = ( |
| 1586 | connection.connection.cursor() |
| 1587 | ) |
| 1588 | else: |
| 1589 | raise |
| 1590 | else: |
| 1591 | return True |
| 1592 | |
| 1593 | e = engine.execution_options(isolation_level="AUTOCOMMIT") |
| 1594 |
nothing calls this directly
no test coverage detected