diff --git a/bstrd/bscache.py b/bstrd/bscache.py index 8620366..c8dbfac 100644 --- a/bstrd/bscache.py +++ b/bstrd/bscache.py @@ -4,6 +4,12 @@ from .bsvar import BSVar from .prodthread import ProdThread +FIXED_CHANNELS = { + "pid", + "toc" +} + + class BSCache: def __init__(self, timeout=1000, maxsize=100): @@ -51,7 +57,7 @@ class BSCache: new_chans = {} for name, kwargs in names.items(): - if name not in ["pid", "toc"] and name not in self.channels: + if name not in FIXED_CHANNELS and name not in self.channels: if not is_available(name): raise ValueError(f"channel {name} is not available") cfg = make_channel_config(name, *kwargs) @@ -72,13 +78,13 @@ class BSCache: next(self) while not chans.keys() <= self.data.keys(): - missing = self.data.keys() - chans.keys() - {"pid", "toc"} + missing = self.data.keys() - chans.keys() - FIXED_CHANNELS print("dropping data that is missing new channel(s)", sorted(missing)) next(self) def get_var(self, name, modulo=None, offset=None): - if name not in ["pid", "toc"] and name not in self.channels: + if name not in FIXED_CHANNELS and name not in self.channels: if not is_available(name): raise ValueError(f"channel {name} is not available") cfg = make_channel_config(name, modulo, offset)