couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [26/50] ibrowse commit: updated refs/heads/upstream to b28542d
Date Mon, 22 Aug 2016 11:19:52 GMT
Merge branch 'merge_pull_req_123'


Project: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/commit/ae6a9185
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/tree/ae6a9185
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/diff/ae6a9185

Branch: refs/heads/upstream
Commit: ae6a91855bd573015e25878e94c7c6cccdb41471
Parents: ea3305d 3c96a91
Author: Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@gmail.com>
Authored: Mon Sep 28 20:55:25 2015 +0100
Committer: Chandrashekhar Mullaparthi <chandrashekhar.mullaparthi@gmail.com>
Committed: Mon Sep 28 20:55:25 2015 +0100

----------------------------------------------------------------------
 .gitignore                        |   1 +
 CONTRIBUTORS                      |   3 +
 Makefile                          |   7 +-
 README.md                         |   2 +-
 include/ibrowse.hrl               |   7 +-
 rebar                             | Bin 90778 -> 188026 bytes
 src/ibrowse.erl                   | 155 +++++++++++---------
 src/ibrowse_http_client.erl       | 251 +++++++++++++++++++++------------
 src/ibrowse_lb.erl                | 108 +++++---------
 src/ibrowse_lib.erl               |  10 +-
 test/ibrowse_functional_tests.erl | 174 +++++++++++++++++++++++
 test/ibrowse_load_test.erl        | 181 ++++++++++++++++++++++++
 test/ibrowse_test.erl             | 155 ++++++++++++++++----
 test/ibrowse_test_server.erl      | 124 +++++++++++-----
 14 files changed, 876 insertions(+), 302 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/ae6a9185/CONTRIBUTORS
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/ae6a9185/README.md
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/ae6a9185/src/ibrowse.erl
----------------------------------------------------------------------
diff --cc src/ibrowse.erl
index 1ffa11b,51fcb86..46a3708
--- a/src/ibrowse.erl
+++ b/src/ibrowse.erl
@@@ -340,7 -341,7 +345,7 @@@ send_req(Url, Headers, Method, Body, Op
                                  Max_sessions, 
                                  Max_pipeline_size,
                                  {SSLOptions, IsSSL}, 
-                                 Headers, Method, Body, Options_1, Timeout, Max_attempts,
0);
 -                                Headers, Method, Body, Options_1, Timeout, Timeout, os:timestamp(),
0);
++                                Headers, Method, Body, Options_1, Timeout, Timeout, os:timestamp(),
Max_attempts, 0);
          Err ->
              {error, {url_parsing_failed, Err}}
      end.
@@@ -349,7 -350,8 +354,8 @@@ try_routing_request(Lb_pid, Parsed_url
                      Max_sessions, 
                      Max_pipeline_size,
                      {SSLOptions, IsSSL}, 
-                     Headers, Method, Body, Options_1, Timeout, Max_attempts, Try_count)
when Try_count < Max_attempts ->
+                     Headers, Method, Body, Options_1, Timeout,
 -                    Ori_timeout, Req_start_time, Try_count) when Try_count =< 3 ->
++                    Ori_timeout, Req_start_time, Max_attempts, Try_count) when Try_count
< Max_attempts ->
      ProcessOptions = get_value(worker_process_options, Options_1, []),
      case ibrowse_lb:spawn_connection(Lb_pid, Parsed_url,
                                               Max_sessions, 
@@@ -360,18 -362,29 +366,29 @@@
              case do_send_req(Conn_Pid, Parsed_url, Headers,
                               Method, Body, Options_1, Timeout) of
                  {error, sel_conn_closed} ->
-                     try_routing_request(Lb_pid, Parsed_url,
-                                         Max_sessions, 
-                                         Max_pipeline_size,
-                                         {SSLOptions, IsSSL}, 
-                                         Headers, Method, Body, Options_1, Timeout, Max_attempts,
Try_count + 1);
+                     Time_now = os:timestamp(),
+                     Time_taken_so_far = trunc(round(timer:now_diff(Time_now, Req_start_time)/1000)),
+                     Time_remaining = Ori_timeout - Time_taken_so_far,
+                     Time_remaining_percent = trunc(round((Time_remaining/Ori_timeout)*100)),
+                     %% io:format("~p -- Time_remaining: ~p (~p%)~n", [self(), Time_remaining,
Time_remaining_percent]),
+                     case (Time_remaining > 0) andalso (Time_remaining_percent >= 5)
of
+                         true ->
+                             try_routing_request(Lb_pid, Parsed_url,
+                                                 Max_sessions, 
+                                                 Max_pipeline_size,
+                                                 {SSLOptions, IsSSL}, 
+                                                 Headers, Method, Body, Options_1,
 -                                                Time_remaining, Ori_timeout, Req_start_time,
Try_count + 1);
++                                                Time_remaining, Ori_timeout, Req_start_time,
Max_attempts, Try_count + 1);
+                         false ->
+                             {error, retry_later}
+                     end;
                  Res ->
                      Res
              end;
          Err ->
              Err
      end;
- try_routing_request(_, _, _, _, _, _, _, _, _, _, _, _) ->
 -try_routing_request(_, _, _, _, _, _, _, _, _, _, _, _, _) ->
++try_routing_request(_, _, _, _, _, _, _, _, _, _, _, _, _, _) ->
      {error, retry_later}.
  
  merge_options(Host, Port, Options) ->

http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/ae6a9185/src/ibrowse_http_client.erl
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/couchdb-ibrowse/blob/ae6a9185/test/ibrowse_test.erl
----------------------------------------------------------------------


Mime
View raw message