@@ -533,20 +533,21 @@ TEST_F(BasicCurlHttpTests, ElegantQuitQuick)
533533{
534534 auto http_client = http_client::HttpClientFactory::Create ();
535535 std::static_pointer_cast<curl::HttpClient>(http_client)->MaybeSpawnBackgroundThread ();
536- auto beg = std::chrono::system_clock::now ();
537536 // start background first, then test it could wakeup
538537 auto session = http_client->CreateSession (" http://127.0.0.1:19000/get/" );
539538 auto request = session->CreateRequest ();
540539 request->SetUri (" get/" );
541540 auto handler = std::make_shared<GetEventHandler>();
542541 session->SendRequest (handler);
542+ std::this_thread::sleep_for (std::chrono::milliseconds{10 }); // let it enter poll state
543+ auto beg = std::chrono::system_clock::now ();
543544 http_client->FinishAllSessions ();
544545 http_client.reset ();
545546 // when use background_thread_wait_for_ should have no side effort on elegant quit
546- // because ci machine may slow, so we assert it cost should less than
547- // scheduled_delay_milliseconds_
547+ // it shoule less than scheduled_delay_milliseconds_
548+ // because ci machine may slow, some take 10ms, so we assert it less than 20ms
548549 auto cost = std::chrono::system_clock::now () - beg;
549- ASSERT_TRUE (cost < std::chrono::milliseconds{10 })
550+ ASSERT_TRUE (cost < std::chrono::milliseconds{20 })
550551 << " cost ms: " << std::chrono::duration_cast<std::chrono::milliseconds>(cost).count ()
551552 << " libcurl version: 0x" << std::hex << LIBCURL_VERSION_NUM;
552553 ASSERT_TRUE (handler->is_called_ );
0 commit comments