From: Michael Tremer Date: Wed, 6 Aug 2025 15:06:23 +0000 (+0100) Subject: suricata-reporter: Make the number of workers configurable X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fea4ffd5b74b0fd6a7709796bc4d009aa9f867e;p=ipfire-2.x.git suricata-reporter: Make the number of workers configurable Signed-off-by: Michael Tremer --- diff --git a/config/suricata/suricata-reporter b/config/suricata/suricata-reporter index 8235373f9..fbbc0761c 100644 --- a/config/suricata/suricata-reporter +++ b/config/suricata/suricata-reporter @@ -60,7 +60,13 @@ class Reporter(object): self.config.read(config) # Fetch CPU count - cpu_count = multiprocessing.cpu_count() + workers = self.config.getint("DEFAULT", "workers", + fallback=multiprocessing.cpu_count()) + + # Check if workers are a positive number + if workers < 1: + log.error("Invalid number of workers: %s" % workers) + raise SystemExit(1) # Fetch the current event loop self.loop = asyncio.get_running_loop() @@ -73,7 +79,7 @@ class Reporter(object): # Create as many workers as we have processors self.workers = [ - Worker(reporter=self) for _ in range(cpu_count) + Worker(reporter=self) for _ in range(workers) ] # Register any signals