Skip to content

Commit

Permalink
Do not unconditioanlly retry a request which was closed unexpectedly
Browse files Browse the repository at this point in the history
In some case such as when replicator flushes a document received from an
open_revs response, it explictly sets the number of retries to 0 because
the context for that request might not be restartable and the retry should
happen at a higher level.

Issue apache#574
  • Loading branch information
nickva committed Jul 28, 2017
1 parent 19bd99a commit d246ba0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/couch_replicator/src/couch_replicator_httpc.erl
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ stop_and_release_worker(Pool, Worker) ->
end,
ok = couch_replicator_httpc_pool:release_worker_sync(Pool, Worker).

process_response({error, sel_conn_closed}, _Worker, HttpDb, Params, _Cb) ->
throw({retry, HttpDb, Params});
process_response({error, sel_conn_closed}, Worker, HttpDb, Params, _Cb) ->
stop_and_release_worker(HttpDb#httpdb.httpc_pool, Worker),
maybe_retry(sel_conn_closed, Worker, HttpDb, Params);


%% This clause handles un-expected connection closing during pipelined requests.
%% For example, if server responds to a request, sets Connection: close header
Expand Down

0 comments on commit d246ba0

Please sign in to comment.