(future, num_attempts)
| 160 | # * Otherwise, invoke a new async_call with the same |
| 161 | # retry_handler. |
| 162 | def retry_handler(future, num_attempts): |
| 163 | e = future.exception() |
| 164 | if e is None: |
| 165 | completion_event.set() |
| 166 | return |
| 167 | else: |
| 168 | logger.info("RPC call %s got error %s", api_method, e) |
| 169 | # If unable to retry, proceed to completion. |
| 170 | if e.code() not in _GRPC_RETRYABLE_STATUS_CODES: |
| 171 | completion_event.set() |
| 172 | return |
| 173 | if num_attempts >= _GRPC_RETRY_MAX_ATTEMPTS: |
| 174 | completion_event.set() |
| 175 | return |
| 176 | # If able to retry, wait then do so. |
| 177 | backoff_secs = _compute_backoff_seconds(num_attempts) |
| 178 | clock.sleep(backoff_secs) |
| 179 | async_call( |
| 180 | functools.partial(retry_handler, num_attempts=num_attempts + 1) |
| 181 | ) |
| 182 | |
| 183 | async_call(functools.partial(retry_handler, num_attempts=1)) |
| 184 | return async_future |
nothing calls this directly
no test coverage detected
searching dependent graphs…