about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-11-20T18·07+0100
committerGitHub <noreply@github.com>2018-11-20T18·07+0100
commitebeea068d52abd02adbbfed3a0f7555300d6b048 (patch)
treefff808c98db200e68bbeacd2f70789fad12fa3a1 /src/libstore
parent5e64470b192271ce60bea2f5c5fcc556227f86a1 (diff)
parent6bf7dc1baf272b37aa2731544f00491402d323ff (diff)
Merge pull request #2216 from dtzWill/fix/curl-760-timeout
download: if there are active requests, never sleep for 10s
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/download.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc
index f44f1836b31e..7773d903265b 100644
--- a/src/libstore/download.cc
+++ b/src/libstore/download.cc
@@ -528,10 +528,11 @@ struct CurlDownloader : public Downloader
             extraFDs[0].fd = wakeupPipe.readSide.get();
             extraFDs[0].events = CURL_WAIT_POLLIN;
             extraFDs[0].revents = 0;
+            long maxSleepTimeMs = items.empty() ? 10000 : 100;
             auto sleepTimeMs =
                 nextWakeup != std::chrono::steady_clock::time_point()
                 ? std::max(0, (int) std::chrono::duration_cast<std::chrono::milliseconds>(nextWakeup - std::chrono::steady_clock::now()).count())
-                : 10000;
+                : maxSleepTimeMs;
             vomit("download thread waiting for %d ms", sleepTimeMs);
             mc = curl_multi_wait(curlm, extraFDs, 1, sleepTimeMs, &numfds);
             if (mc != CURLM_OK)