Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
spec-exec: don't retry requests that fail http 400
Browse files Browse the repository at this point in the history
if the request is bad, there is no point retrying on a different replica
of the same shard. breaking the limit on one, will also break it on the
2nd.  See also #985
  • Loading branch information
Dieterbe committed Oct 16, 2020
1 parent a057f79 commit df76f3e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,13 @@ func queryPeers(ctx context.Context, peerGroups map[int32][]cluster.Node, name s
}

if resp.err != nil {
// TODO complete abort if error is limit breached!
if resp.err.Error() == "400 Bad Request" {
// if we got bad request, then retrying it on a different replica will result in the same
// Cancel the reqCtx, which will cancel all in-flight requests.
cancel()
errorChan <- resp.err
return
}

// if we can try another peer for this shardGroup, do it
_, ok := states[resp.shardGroup].AskPeer(reqCtx, peerGroups, fetchFn, responses)
Expand Down

0 comments on commit df76f3e

Please sign in to comment.