Skip to content

Commit

Permalink
proxy: Do not retry if there is timeout error for request on master
Browse files Browse the repository at this point in the history
  • Loading branch information
AymericDu committed Mar 25, 2021
1 parent 679a6ce commit d8ab0a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions proxy/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,15 @@ gridd_request_replicated (struct req_args_s *args, struct client_ctx_s *ctx,
&& ctx->which != CLIENT_SPECIFIED) && !next_url) {
err = BUSY("No service replied");
stop = TRUE;
} else if (ctx->which == CLIENT_PREFER_MASTER &&
(err->code == ERRCODE_CONN_CLOSED
|| err->code == ERRCODE_READ_TIMEOUT)) {
/* Maybe the request is running in the background.
* For requests on master, let the client decide to try again.
* Retrying may trigger an error (such as a conflict),
* if the request has already been executed. */
err = BUSY("No service replied");
stop = TRUE;
}
} else if (CODE_IS_RETRY(err->code)) {
/* the target service is in bad shape, let's avoid it for
Expand Down

0 comments on commit d8ab0a6

Please sign in to comment.