summaryrefslogtreecommitdiff
path: root/src/ingestor.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-10-02 23:42:52 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-10-02 23:42:52 +0100
commit5aa9cca0d2ff25c541d7df3b63519c28eb75b656 (patch)
treec43e515374b08e2897b295c2706b8797cfc1e38b /src/ingestor.cpp
parentedfaf671d016f675a3a3b87d58d615a92e84148b (diff)
downloadwebstat-5aa9cca0d2ff25c541d7df3b63519c28eb75b656.tar.bz2
webstat-5aa9cca0d2ff25c541d7df3b63519c28eb75b656.tar.xz
webstat-5aa9cca0d2ff25c541d7df3b63519c28eb75b656.zip
Add point to execute scheduled jobs when idle
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r--src/ingestor.cpp6
1 files changed, 5 insertions, 1 deletions
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<std::string>(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();