From 6d54928d7c0aac758f3eddfe82169e27109a6255 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 24 Dec 2019 16:07:33 +0100 Subject: Revert "lib/curl/Global: remove lower bound on timeouts" This reverts commit 4475b8ca04b2798519d0f6eb68913c55cf3d1846. Further testing revealed that the threaded resolver still uses a timeout of 0ms. This revert however lowers the bound to a minimum of 1ms instead of 10ms. --- src/lib/curl/Global.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/curl/Global.cxx b/src/lib/curl/Global.cxx index 4acb16fe6..0cd8b533d 100644 --- a/src/lib/curl/Global.cxx +++ b/src/lib/curl/Global.cxx @@ -225,6 +225,13 @@ CurlGlobal::UpdateTimeout(long timeout_ms) noexcept return; } + if (timeout_ms < 1) + /* CURL's threaded resolver sets a timeout of 0ms, which + means we're running in a busy loop. Quite a bad + idea to waste so much CPU. Let's use a lower limit + of 1ms. */ + timeout_ms = 1; + timeout_event.Schedule(std::chrono::milliseconds(timeout_ms)); } -- cgit v1.2.3