diff options
| author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-05-07 15:40:11 +0100 |
|---|---|---|
| committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-05-07 15:40:11 +0100 |
| commit | cbb2035fd33ba84fea56c7a7223c563b925e8649 (patch) | |
| tree | 6f0c5ea268354c9b70b8f87159efafa8c4a8cdcf /src/ingestor.cpp | |
| parent | 200c3636b600ac2f997316612f1b1321112496cd (diff) | |
| download | webstat-cbb2035fd33ba84fea56c7a7223c563b925e8649.tar.bz2 webstat-cbb2035fd33ba84fea56c7a7223c563b925e8649.tar.xz webstat-cbb2035fd33ba84fea56c7a7223c563b925e8649.zip | |
Add support for conditional job execution
Performs a check before launching a job thread, rather than just having
it exit immediately.
Diffstat (limited to 'src/ingestor.cpp')
| -rw-r--r-- | src/ingestor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ingestor.cpp b/src/ingestor.cpp index fe8d38c..5f9fa60 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -426,7 +426,9 @@ namespace WebStat { } } else if (expired(job.lastRun, freq, now)) { - job.currentRun.emplace(std::async(job.impl, this)); + if (!job.cond || std::invoke(job.cond, this)) { + job.currentRun.emplace(std::async(job.impl, this)); + } } }; runJobAsNeeded(ingestParkedLines, settings.freqIngestParkedLines); |
