only check channel availability if using the dispatcher, i.e., if there is no host configured
This commit is contained in:
@ -73,7 +73,8 @@ class BSCache:
|
|||||||
new_chans = {}
|
new_chans = {}
|
||||||
for name, kwargs in names.items():
|
for name, kwargs in names.items():
|
||||||
if name not in FIXED_CHANNELS and name not in self.channels:
|
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)
|
cfg = make_channel_config(name, *kwargs)
|
||||||
new_chans[name] = cfg
|
new_chans[name] = cfg
|
||||||
|
|
||||||
@ -86,7 +87,8 @@ class BSCache:
|
|||||||
|
|
||||||
def get_var(self, name, modulo=None, offset=None):
|
def get_var(self, name, modulo=None, offset=None):
|
||||||
if name not in FIXED_CHANNELS and name not in self.channels:
|
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)
|
cfg = make_channel_config(name, modulo, offset)
|
||||||
print("add new channel", name)
|
print("add new channel", name)
|
||||||
self.add_var(name, cfg)
|
self.add_var(name, cfg)
|
||||||
@ -122,6 +124,10 @@ class BSCache:
|
|||||||
def flush(self):
|
def flush(self):
|
||||||
self.pt.queue.clear()
|
self.pt.queue.clear()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def uses_dispatcher(self):
|
||||||
|
return bool(self.kwargs["host"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check_availability(name):
|
def check_availability(name):
|
||||||
|
Reference in New Issue
Block a user