diff options
| author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-03-17 11:48:34 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-03-17 11:48:34 +0000 |
| commit | d2ecb7f49c3f3b60e3d1f297fd033071a02cfa9a (patch) | |
| tree | 90c34529461f86f2b6f59ba44f9d910214ed8630 /src/ingestor.hpp | |
| parent | 0e3c2e8dd462a7d56f8b61e15c8cf10681898a1f (diff) | |
| download | webstat-d2ecb7f49c3f3b60e3d1f297fd033071a02cfa9a.tar.bz2 webstat-d2ecb7f49c3f3b60e3d1f297fd033071a02cfa9a.tar.xz webstat-d2ecb7f49c3f3b60e3d1f297fd033071a02cfa9a.zip | |
Execute jobs even when processing incoming logs
Jobs run on background threads now, so we can happily run them even when
we're busy.
Diffstat (limited to 'src/ingestor.hpp')
| -rw-r--r-- | src/ingestor.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<milliseconds>(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<std::thread> currentRun {std::nullopt}; }; + Job::LastRunTime lastCheckedJobs {Job::LastRunTime::clock::now()}; Job ingestParkedLines; Job purgeOldLogs; |
