From cbb2035fd33ba84fea56c7a7223c563b925e8649 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 7 May 2026 15:40:11 +0100 Subject: Add support for conditional job execution Performs a check before launching a job thread, rather than just having it exit immediately. --- src/ingestor.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ingestor.hpp') diff --git a/src/ingestor.hpp b/src/ingestor.hpp index dd803ce..a51c46c 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -46,10 +46,12 @@ namespace WebStat { using LastRunTime = std::chrono::system_clock::time_point; using Result = std::function; using Impl = Result (Ingestor::*)(); + using Cond = bool (Ingestor::*)(); - explicit Job(Impl jobImpl) : impl(jobImpl) { } + explicit Job(Impl jobImpl, Cond jobCond = nullptr) : impl {jobImpl}, cond {jobCond} { } const Impl impl; + const Cond cond; LastRunTime lastRun {LastRunTime::clock::now()}; std::optional> currentRun; }; -- cgit v1.3