main.py: secured queue_processor with try/except due to receiving multiple None messages, will try to figure out what is broken there
This commit is contained in:
parent
a1d76d3bad
commit
eb51a5d2ee
9
main.py
9
main.py
|
@ -155,6 +155,7 @@ class ModuleControlUnit:
|
|||
# synchronous message processor
|
||||
def queue_processor():
|
||||
while True:
|
||||
try:
|
||||
if len(message_queue) > 0:
|
||||
msg = message_queue[0]
|
||||
print("[DEBUG] queue_processor: {}".format(msg)) # debug
|
||||
|
@ -189,6 +190,14 @@ def queue_processor():
|
|||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
except Exception as e:
|
||||
print("[ERROR] queue_processor: current message queue: {}".format(message_queue))
|
||||
print("[ERROR] queue_processor: error while processing message, trying to delete it...")
|
||||
try:
|
||||
del message_queue[0]
|
||||
print("[INFO] queue_processor: deleted broken message from the queue")
|
||||
except:
|
||||
print("[WARN] queue_processor: message seems absent, whatever")
|
||||
|
||||
print("[INFO] queue_processor thread stops successfully")
|
||||
|
||||
|
|
Loading…
Reference in New Issue