diff --git a/cpp/httpclientpool.cc b/cpp/httpclientpool.cc index f76a29b..2c2883c 100644 --- a/cpp/httpclientpool.cc +++ b/cpp/httpclientpool.cc @@ -135,12 +135,22 @@ namespace f8 switch (node->method) { case 1: { + long long begin_tick = a8::XGetTickCount(); ret = a8::http::Get(finally_url, response, &node->headers, 10); + long long end_tick = a8::XGetTickCount(); + if (end_tick - begin_tick > f8::HttpClientPool::Instance()->max_request_delay) { + f8::HttpClientPool::Instance()->max_request_delay = end_tick - begin_tick; + } break; } case 2: { + long long begin_tick = a8::XGetTickCount(); ret = a8::http::Post(finally_url.c_str(), node->content, response, &node->headers, 10); + long long end_tick = a8::XGetTickCount(); + if (end_tick - begin_tick > f8::HttpClientPool::Instance()->max_request_delay) { + f8::HttpClientPool::Instance()->max_request_delay = end_tick - begin_tick; + } break; } default: diff --git a/cpp/httpclientpool.h b/cpp/httpclientpool.h index ca47d3c..df6e766 100644 --- a/cpp/httpclientpool.h +++ b/cpp/httpclientpool.h @@ -13,6 +13,9 @@ namespace f8 HttpClientPool() {}; friend class a8::Singleton; + public: + volatile long long max_request_delay = 0; + public: void Init(int thread_num); void UnInit();