Skip to content

Commit 95fc5bb

Browse files
committed
Increased the performance of the intelmqctl script
It should improve the performance of the check method of the intelmqctl script. The global settings were read from a file with each loop pass, now the settings are read only once and then only copied.
1 parent 2331bda commit 95fc5bb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ CHANGELOG
7575
- `contrib.eventdb.separate-raws-table.sql`: Added the missing commas to complete the sql syntax. (PR#2386, fixes #2125 by Sebastian Kufner)
7676
- `intelmq_psql_initdb`:
7777
- Added parameter `-o` to set the output file destination. (by Sebastian Kufner)
78+
- `intelmqctl`:
79+
- Increased the performance through removing unnecessary reads. (by Sebastian Kufner)
7880

7981
### Known Errors
8082
- `intelmq.parsers.html_table` may not process invalid URLs in patched Python version due to changes in `urllib`. See #2382

intelmq/bin/intelmqctl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
# -*- coding: utf-8 -*-
66
import argparse
7+
import copy
78
import datetime
89
import importlib
910
import json
@@ -925,6 +926,7 @@ def check(self, no_connections=False, check_executables=True):
925926
"intelmqctl upgrade-config.")
926927

927928
check_logger.info('Checking for bots.')
929+
global_settings = files[RUNTIME_CONF_FILE]
928930
for bot_id, bot_config in files[RUNTIME_CONF_FILE].items():
929931
if bot_id != 'global':
930932
# importable module
@@ -939,7 +941,7 @@ def check(self, no_connections=False, check_executables=True):
939941
retval = 1
940942
continue
941943
bot = getattr(bot_module, 'BOT')
942-
bot_parameters = utils.get_global_settings()
944+
bot_parameters = copy.deepcopy(global_settings)
943945
bot_parameters.update(bot_config.get('parameters', {})) # the parameters field may not exist
944946
bot_check = bot.check(bot_parameters)
945947
if bot_check:

0 commit comments

Comments
 (0)