lemonbar: Change write queue to Shelf.
Possibly significant performance increase
This commit is contained in:
@@ -107,7 +107,7 @@ def put_fifo_in_queue():
|
||||
common.logger.debug("Writer closed")
|
||||
break
|
||||
data = data.rstrip() # Remove trailing newlines
|
||||
common.write_queue.put(lemonparser.parse_line(data))
|
||||
common.bar_in_shelf.put(lemonparser.parse_line(data))
|
||||
except BrokenPipeError:
|
||||
common.logger.debug('Broken pipe in parse status thread, exiting')
|
||||
common.health_logger.info('Broken pipe in parse status thread, exiting')
|
||||
@@ -124,12 +124,7 @@ def write_parsed():
|
||||
, stdout=subprocess.PIPE, text=True)
|
||||
|
||||
while True:
|
||||
data = common.write_queue.get() # Blocking read
|
||||
if data is None:
|
||||
common.logger.debug('Queue closed')
|
||||
common.health_logger.info('Queue closed')
|
||||
break
|
||||
|
||||
data = common.bar_in_shelf.get() # Blocking read
|
||||
p_lemonbar.stdin.write(data + '\n')
|
||||
p_lemonbar.stdin.flush()
|
||||
#common.logger.debug('Read: "{0}"'.format(data))
|
||||
@@ -216,7 +211,7 @@ if __name__ == "__main__":
|
||||
signal.signal(signal.SIGTERM, handle_exit)
|
||||
signal.signal(signal.SIGINT, handle_exit)
|
||||
|
||||
common.write_queue = queue.Queue()
|
||||
common.bar_in_shelf = common.Shelf()
|
||||
|
||||
# Start writing and reading threads
|
||||
# Create readers before writers
|
||||
|
||||
Reference in New Issue
Block a user