diff --git a/bstrd/bscache.py b/bstrd/bscache.py index 3cab89d..b220657 100644 --- a/bstrd/bscache.py +++ b/bstrd/bscache.py @@ -26,14 +26,18 @@ class BSCache: def run(self, running): + timeout_counter = 0 configs = self.channels.values() with source(channels=configs, receive_timeout=self.timeout) as src: while running.is_set(): msg = src.receive() if msg is None: + timeout_counter += 1 + print("receive timed out", timeout_counter) continue data = repack(msg) if data: + data["toc"] = timeout_counter yield data @@ -42,7 +46,7 @@ class BSCache: def get_var(self, name, modulo=None, offset=None): - if name != "pid" and name not in self.channels: + if name not in ["pid", "toc"] 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)