From 8c6fecd356003309f8eebec30374344272ca6072 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 19 Mar 2026 12:33:48 +0000 Subject: Gracefully handle SIGTERM Apache sends SIGTERM to the logger process to it shutdown. Honestly I thought it would just close stdin and I should have checked. --- src/ingestor.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ingestor.hpp') diff --git a/src/ingestor.hpp b/src/ingestor.hpp index 0bf2297..2ae2936 100644 --- a/src/ingestor.hpp +++ b/src/ingestor.hpp @@ -39,7 +39,7 @@ namespace WebStat { Ingestor(const utsname &, IngestorSettings); Ingestor(const utsname &, DB::ConnectionPoolPtr, IngestorSettings); - virtual ~Ingestor() = default; + virtual ~Ingestor(); SPECIAL_MEMBERS_DELETE(Ingestor); using ScanResult = decltype(scn::scan existingEntities; + bool terminated = false; + struct Job { using LastRunTime = std::chrono::system_clock::time_point; using Impl = unsigned int (Ingestor::*)(); @@ -98,6 +101,9 @@ namespace WebStat { void jobIngestParkedLine(const std::filesystem::directory_iterator &); void jobIngestParkedLine(const std::filesystem::path &, uintmax_t size); + static void sigtermHandler(int); + void terminate(int); + using CurlOperations = std::map>; uint32_t hostnameId; CurlMultiPtr curl; -- cgit v1.3