Skip to content

Commit

Permalink
Merge pull request #324 from tie/patch-4
Browse files Browse the repository at this point in the history
fix(rpc): drop request on context deadline
  • Loading branch information
ernado committed May 7, 2021
2 parents c7e01d2 + 4b63efc commit 80069da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/rpc/engine.go
Expand Up @@ -140,12 +140,12 @@ func (e *Engine) Do(ctx context.Context, req Request) error {

// Start retrying.
sent, err := e.retryUntilAck(retryCtx, req)
if err != nil && !errors.Is(err, context.Canceled) {
if err != nil && !errors.Is(err, retryCtx.Err()) {
// If the retryCtx was canceled, then one of two things happened:
// 1. User canceled the original context.
// 1. User canceled the parent context.
// 2. The RPC result came and callback canceled retryCtx.
//
// If this is not an context.Canceled error, most likely we did not receive ack
// If this is not a Context’s error, most likely we did not receive ack
// and exceeded the limit of attempts to send a request,
// or could not write data to the connection, so we return an error.
return xerrors.Errorf("retryUntilAck: %w", err)
Expand Down

0 comments on commit 80069da

Please sign in to comment.