From 5aa9cca0d2ff25c541d7df3b63519c28eb75b656 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 2 Oct 2025 23:42:52 +0100 Subject: Add point to execute scheduled jobs when idle --- src/ingestor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ingestor.cpp') diff --git a/src/ingestor.cpp b/src/ingestor.cpp index 639eed0..cf49f52 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -127,7 +127,8 @@ namespace WebStat { { curl_waitfd logIn {.fd = fileno(input), .events = CURL_WAIT_POLLIN, .revents = 0}; - while (curl_multi_poll(curl.get(), &logIn, 1, INT_MAX, nullptr) == CURLM_OK) { + for (int interesting = 0; + curl_multi_poll(curl.get(), &logIn, 1, settings.idleJobsAfter, &interesting) == CURLM_OK;) { if (logIn.revents) { if (auto line = scn::scan(input, "{:[^\n]}\n")) { linesRead++; @@ -140,6 +141,9 @@ namespace WebStat { else if (!curlOperations.empty()) { handleCurlOperations(); } + else if (!interesting) { + // do idle job things + } } while (!curlOperations.empty() && curl_multi_poll(curl.get(), nullptr, 0, INT_MAX, nullptr) == CURLM_OK) { handleCurlOperations(); -- cgit v1.2.3