Fix backlog

This commit is contained in:
Kevin F 2023-03-10 16:06:35 -06:00
parent 0cb8c59882
commit 3d9a31f4af

View File

@ -70,6 +70,7 @@ device.grab()
write_queue = queue.Queue() write_queue = queue.Queue()
def write_loop(): def write_loop():
backlog = [] backlog = []
data = None
while True: while True:
try: try:
while backlog: while backlog:
@ -82,7 +83,8 @@ def write_loop():
except Exception as e: except Exception as e:
print("Error writing to fifo: " + str(e)) print("Error writing to fifo: " + str(e))
traceback.print_exc() traceback.print_exc()
backlog if data != None:
backlog.append(data)
write_thread = threading.Thread(target=write_loop, daemon=True) write_thread = threading.Thread(target=write_loop, daemon=True)
write_thread.start() write_thread.start()