From d2ecb7f49c3f3b60e3d1f297fd033071a02cfa9a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 17 Mar 2026 11:48:34 +0000 Subject: Execute jobs even when processing incoming logs Jobs run on background threads now, so we can happily run them even when we're busy. --- src/ingestor.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ingestor.hpp') diff --git a/src/ingestor.hpp b/src/ingestor.hpp index 72417d9..b158f03 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -23,7 +23,7 @@ namespace WebStat { std::filesystem::path fallbackDir = "/var/log/webstat"; unsigned int dbMax = 4; unsigned int dbKeep = 2; - int idleJobsAfter = duration_cast(1min).count(); + minutes checkJobsAfter = 1min; minutes freqIngestParkedLines = 30min; minutes freqPurgeOldLogs = 6h; unsigned int purgeDaysToKeep = 61; // ~2 months @@ -52,7 +52,7 @@ namespace WebStat { void ingestLogLine(std::string_view); void ingestLogLine(DB::Connection *, std::string_view); void parkLogLine(std::string_view); - void runJobsIdle(); + void runJobsAsNeeded(); unsigned int jobIngestParkedLines(); unsigned int jobPurgeOldLogs(); @@ -81,6 +81,7 @@ namespace WebStat { std::optional currentRun {std::nullopt}; }; + Job::LastRunTime lastCheckedJobs {Job::LastRunTime::clock::now()}; Job ingestParkedLines; Job purgeOldLogs; -- cgit v1.3