Invokes the gRPC future and orchestrates it via the AsyncCallFuture.
(handler)
| 141 | async_future = AsyncCallFuture(completion_event) |
| 142 | |
| 143 | def async_call(handler): |
| 144 | """Invokes the gRPC future and orchestrates it via the AsyncCallFuture.""" |
| 145 | future = api_method.future( |
| 146 | request, |
| 147 | timeout=_GRPC_DEFAULT_TIMEOUT_SECS, |
| 148 | metadata=version_metadata(), |
| 149 | ) |
| 150 | # Ensure we set the active future before invoking the done callback, to |
| 151 | # avoid the case where the done callback completes immediately and |
| 152 | # triggers completion event while async_future still holds the old |
| 153 | # future. |
| 154 | async_future._set_active_future(future) |
| 155 | future.add_done_callback(handler) |
| 156 | |
| 157 | # retry_handler is the continuation of the `async_call`. It should: |
| 158 | # * If the grpc call succeeds: trigger the `completion_event`. |
no test coverage detected
searching dependent graphs…