made BSCache.run() a generator; moved dealing with the queue completely into ProdThread; allowed setting the maxsize of the queue from ProdThread()

This commit is contained in:
2021-09-08 18:40:54 +02:00
parent 36b14b470c
commit 78591549a9
2 changed files with 30 additions and 10 deletions

View File

@ -17,11 +17,11 @@ class BSCache:
def __next__(self):
self.pt.start()
self.data = data = self.pt.queue.get()
self.data = data = self.pt.get()
return data
def run(self, queue, running):
def run(self, running):
channels = self.channels.keys()
configs = self.channels.values()
with source(channels=configs, receive_timeout=-1) as src:
@ -29,7 +29,7 @@ class BSCache:
msg = src.receive()
data = repack(channels, msg)
if data:
queue.put(data)
yield data
def stop(self):