diff options
author | Adam Kocoloski <adam@cloudant.com> | 2013-10-02 15:25:57 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2013-10-02 15:35:54 -0400 |
commit | a72d1f9c895ddfed00f27820a9b46e17d50515c9 (patch) | |
tree | d3cc5644fee5ab72a8aef376ba74520eb1485a09 | |
parent | 37aa350109753c5f3648fcfa04db812542477543 (diff) | |
download | couchdb-a72d1f9c895ddfed00f27820a9b46e17d50515c9.tar.gz |
Be a bit nicer about logging
-rw-r--r-- | src/couch_replicator/src/couch_replicator_api_wrap.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl index f779747bf..eb7d84504 100644 --- a/src/couch_replicator/src/couch_replicator_api_wrap.erl +++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl @@ -222,7 +222,7 @@ open_doc_revs(#httpdb{} = HttpDb, Id, Revs, Options, Fun, Acc) -> #httpdb{retries = Retries, wait = Wait0} = HttpDb, Wait = 2 * erlang:min(Wait0 * 2, ?MAX_WAIT), ?LOG_INFO("Retrying GET to ~s in ~p seconds due to error ~p", - [Url, Wait / 1000, Else] + [Url, Wait / 1000, error_reason(Else)] ), ok = timer:sleep(Wait), RetryDb = HttpDb#httpdb{ @@ -235,6 +235,14 @@ open_doc_revs(Db, Id, Revs, Options, Fun, Acc) -> {ok, Results} = couch_db:open_doc_revs(Db, Id, Revs, Options), {ok, lists:foldl(fun(R, A) -> {_, A2} = Fun(R, A), A2 end, Acc, Results)}. +error_reason({http_request_failed, "GET", _Url, {error, timeout}}) -> + timeout; +error_reason({http_request_failed, "GET", _Url, {error, {_, req_timedout}}}) -> + req_timedout; +error_reason({http_request_failed, "GET", _Url, Error}) -> + Error; +error_reason(Else) -> + Else. open_doc(#httpdb{} = Db, Id, Options) -> send_req( |