From 7e9c1f3d208e0f60cc08aa32248a8c7c8c01d537 Mon Sep 17 00:00:00 2001 From: sguazt <marco.guazzone@gmail.com> Date: Thu, 14 Jan 2021 16:19:19 +0100 Subject: [PATCH] Core: small optimization (avoid looking for measure sinks if the configuration parameter is an empty string) --- easycloud/core/metamonitor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/easycloud/core/metamonitor.py b/easycloud/core/metamonitor.py index bd75b18..0f8e2f6 100755 --- a/easycloud/core/metamonitor.py +++ b/easycloud/core/metamonitor.py @@ -79,7 +79,7 @@ class MetaMonitor(ABC): self._measures_sink_thread = None measures_sinks = [] measures_sink_labels = conf.get_parameter('options', 'measures_sinks', return_type=str) - if measures_sink_labels is not None: + if measures_sink_labels: for sink in measures_sink_labels.split(','): measures_sink_params = conf.get_parameters('measures_sink.' + sink.strip()) if 'module' not in measures_sink_params or 'class' not in measures_sink_params: @@ -89,9 +89,9 @@ class MetaMonitor(ABC): clazz = getattr(module, measures_sink_params['class']) instance = clazz.from_conf(measures_sink_params) measures_sinks.append(instance) - self._measures_sink_thread = threading.Thread(target=self._measures_sink_runner, args=(measures_sinks,)) - ##self._measures_sink_thread.setDaemon(True) #FIXME: is this really necessary? It seems that without it, the EasyCloud app blocks on exit - #self._measures_sink_thread.daemon = True #FIXME: is this really necessary? It seems that without it, the EasyCloud app blocks on exit + self._measures_sink_thread = threading.Thread(target=self._measures_sink_runner, args=(measures_sinks,)) + ##self._measures_sink_thread.setDaemon(True) #FIXME: is this really necessary? It seems that without it, the EasyCloud app blocks on exit + #self._measures_sink_thread.daemon = True #FIXME: is this really necessary? It seems that without it, the EasyCloud app blocks on exit #[ALTERNATIVE #1] """ -- GitLab