From 4fea4ffd5b74b0fd6a7709796bc4d009aa9f867e Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 6 Aug 2025 16:06:23 +0100 Subject: [PATCH] suricata-reporter: Make the number of workers configurable Signed-off-by: Michael Tremer --- config/suricata/suricata-reporter | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 -- 2.47.3