diff --git a/src/config.py b/src/config.py index 7d6048df3..770c807e1 100644 --- a/src/config.py +++ b/src/config.py @@ -153,6 +153,7 @@ class Plugin(BaseModel): ssdeep_ignore: int intercom_poll_delay: float + analysis_status_update_interval: float = 4.5 throw_exceptions: bool diff --git a/src/config/fact-core-config.toml b/src/config/fact-core-config.toml index d114a1821..194a8fc21 100644 --- a/src/config/fact-core-config.toml +++ b/src/config/fact-core-config.toml @@ -61,6 +61,7 @@ firmware-file-storage-directory = "/media/data/fact_fw_data" block-delay = 0.1 ssdeep-ignore = 1 intercom-poll-delay = 1.0 +analysis-status-update-interval = 4.5 scheduling-worker-count = 4 collector-worker-count = 2 throw-exceptions = false diff --git a/src/conftest.py b/src/conftest.py index 3cb641ca8..2c2e0f035 100644 --- a/src/conftest.py +++ b/src/conftest.py @@ -106,6 +106,7 @@ def backend_config(request, common_config, firmware_file_storage_directory) -> c 'block_delay': 0.1, 'ssdeep_ignore': 1, 'intercom_poll_delay': 0.1, + 'analysis_status_update_interval': 0.2, 'throw_exceptions': True, # Always throw exceptions to avoid miraculous timeouts in test cases 'plugin_defaults': {'processes': 1}, 'unpacking': { diff --git a/src/scheduler/analysis_status.py b/src/scheduler/analysis_status.py index 502952f74..1973ad588 100644 --- a/src/scheduler/analysis_status.py +++ b/src/scheduler/analysis_status.py @@ -10,6 +10,7 @@ from time import time from typing import TYPE_CHECKING, Dict, Set +import config from helperFunctions.process import stop_process from objects.firmware import Firmware from storage.redis_status_interface import RedisStatusInterface @@ -17,7 +18,6 @@ if TYPE_CHECKING: from objects.file import FileObject -UPDATE_INTERVAL = 4.5 # a bit less than the update interval on the system health page, FixMe: -> configuration RECENTLY_FINISHED_DISPLAY_TIME_IN_SEC = 300 @@ -116,11 +116,11 @@ def _worker_loop(self): logging.debug(f'updating status (queue: {self.queue.qsize()})') self._clear_recently_finished() self._store_status() - next_update_time = current_time + UPDATE_INTERVAL + next_update_time = current_time + config.backend.analysis_status_update_interval logging.debug('stopped analysis status worker') def _update_status(self): - update_type, *args = self.queue.get(timeout=UPDATE_INTERVAL) + update_type, *args = self.queue.get(timeout=config.backend.analysis_status_update_interval) if update_type == _UpdateType.add_update: self._add_update(*args) elif update_type == _UpdateType.add_firmware: