(session)
| 1040 | |
| 1041 | # Start Transactions Retry Example 2 |
| 1042 | async def commit_with_retry(session): |
| 1043 | while True: |
| 1044 | try: |
| 1045 | # Commit uses write concern set at transaction start. |
| 1046 | await session.commit_transaction() |
| 1047 | print("Transaction committed.") |
| 1048 | break |
| 1049 | except (ConnectionFailure, OperationFailure) as exc: |
| 1050 | # Can retry commit |
| 1051 | if exc.has_error_label("UnknownTransactionCommitResult"): |
| 1052 | print("UnknownTransactionCommitResult, retrying commit operation ...") |
| 1053 | continue |
| 1054 | else: |
| 1055 | print("Error during commit ...") |
| 1056 | raise |
| 1057 | |
| 1058 | # End Transactions Retry Example 2 |
| 1059 |
nothing calls this directly
no outgoing calls
no test coverage detected