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:
@ -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):
|
||||
|
Reference in New Issue
Block a user