From 153fdb754ecfc7a4a0b608736c9ea44f105bfb2e Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Tue, 11 Feb 2025 11:57:57 +0100 Subject: [PATCH] only check channel availability if using the dispatcher, i.e., if there is no host configured --- bstrd/bscache.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bstrd/bscache.py b/bstrd/bscache.py index 745361a..ea1c6dc 100644 --- a/bstrd/bscache.py +++ b/bstrd/bscache.py @@ -73,7 +73,8 @@ class BSCache: new_chans = {} for name, kwargs in names.items(): if name not in FIXED_CHANNELS and name not in self.channels: - check_availability(name) + if self.uses_dispatcher: + check_availability(name) cfg = make_channel_config(name, *kwargs) new_chans[name] = cfg @@ -86,7 +87,8 @@ class BSCache: def get_var(self, name, modulo=None, offset=None): if name not in FIXED_CHANNELS and name not in self.channels: - check_availability(name) + if self.uses_dispatcher: + check_availability(name) cfg = make_channel_config(name, modulo, offset) print("add new channel", name) self.add_var(name, cfg) @@ -122,6 +124,10 @@ class BSCache: def flush(self): self.pt.queue.clear() + @property + def uses_dispatcher(self): + return bool(self.kwargs["host"]) + def check_availability(name):