unified starting by checking all (instead of new) channels vs. received channels

This commit is contained in:
2023-06-07 20:01:41 +02:00
parent 36cf0d9724
commit e1aef2dc82

View File

@ -47,6 +47,19 @@ class BSCache:
yield data yield data
def start(self):
self.pt.start()
while self.data is None:
print("dropping empty data")
next(self)
while not self.channels.keys() <= self.data.keys():
missing = self.channels.keys() - self.data.keys() - FIXED_CHANNELS
print("dropping data that is missing channel(s):", sorted(missing))
next(self)
def stop(self): def stop(self):
self.pt.stop() self.pt.stop()
@ -68,19 +81,10 @@ class BSCache:
def update_source_multiple(self, chans): def update_source_multiple(self, chans):
self.pt.stop() self.stop()
print("add channels", sorted(chans)) print("add channels", sorted(chans))
self.channels.update(chans) self.channels.update(chans)
self.pt.start() self.start()
while self.data is None:
print("dropping empty data")
next(self)
while not chans.keys() <= self.data.keys():
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): def get_var(self, name, modulo=None, offset=None):
@ -93,18 +97,10 @@ class BSCache:
def update_source(self, name, cfg): def update_source(self, name, cfg):
self.pt.stop() self.stop()
print("add channel", name) print("add channel", name)
self.channels[name] = cfg self.channels[name] = cfg
self.pt.start() self.start()
while self.data is None:
print("dropping empty data")
next(self)
while name not in self.data:
print("dropping data that is missing new channel:", name)
next(self)
def flush(self): def flush(self):