Skip to content

Commit 9820b8e

Browse files
committed
fix unittest
1 parent 992f939 commit 9820b8e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ext/src/http/client/curl/http_client_curl.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ bool HttpClient::MaybeSpawnBackgroundThread()
433433
}
434434

435435
std::chrono::milliseconds wait_for = std::chrono::milliseconds::zero();
436-
;
437-
#if LIBCURL_VERSION_NUM >= 0x074200
438-
// only avaliable with curl_multi_poll, because curl_multi_wait would cause CPU busy,
439-
// curl_multi_wait+sleep could not wakeup quickly
436+
437+
#if LIBCURL_VERSION_NUM >= 0x074400
438+
// only available with curl_multi_poll+curl_multi_wakeup, because curl_multi_wait would
439+
// cause CPU busy, curl_multi_wait+sleep could not wakeup quickly
440440
wait_for = self->background_thread_wait_for_;
441441
#endif
442442
if (self->is_shutdown_.load(std::memory_order_acquire))

ext/test/http/curl_http_test.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,10 @@ TEST_F(BasicCurlHttpTests, ElegantQuitQuick)
545545
// when use background_thread_wait_for_ should have no side effort on elegant quit
546546
// because ci machine may slow, so we assert it cost should less than
547547
// scheduled_delay_milliseconds_
548-
ASSERT_TRUE(std::chrono::system_clock::now() - beg < std::chrono::milliseconds{20});
548+
auto cost = std::chrono::system_clock::now() - beg;
549+
ASSERT_TRUE(cost < std::chrono::milliseconds{10})
550+
<< "cost ms: " << std::chrono::duration_cast<std::chrono::milliseconds>(cost).count()
551+
<< " libcurl version: 0x" << std::hex << LIBCURL_VERSION_NUM;
549552
ASSERT_TRUE(handler->is_called_);
550553
ASSERT_TRUE(handler->got_response_);
551554
}

0 commit comments

Comments
 (0)