| 43 | } |
| 44 | |
| 45 | void RpcRetrier::DelayedRetry(Rpc* rpc, const Status& why_status) { |
| 46 | if (!why_status.ok() && (last_error_.ok() || last_error_.IsTimedOut())) { |
| 47 | last_error_ = why_status; |
| 48 | } |
| 49 | // If the delay causes us to miss our deadline, RetryCb will fail the |
| 50 | // RPC on our behalf. |
| 51 | MonoDelta backoff = ComputeBackoff(attempt_num_++); |
| 52 | messenger_->ScheduleOnReactor( |
| 53 | [this, rpc](const Status& s) { this->DelayedRetryCb(rpc, s); }, backoff); |
| 54 | } |
| 55 | |
| 56 | MonoDelta RpcRetrier::ComputeBackoff(int num_attempts) const { |
| 57 | if (backoff_ == BackoffType::LINEAR) { |
no test coverage detected