updated module-testing.py to match the latest update of main.py
This commit is contained in:
parent
baa8a4c7ae
commit
e874b98896
|
@ -154,6 +154,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
|
||||
|
@ -178,7 +179,7 @@ def queue_processor():
|
|||
if mod.version == 1:
|
||||
responce = mod.process(msg)
|
||||
if len(responce) > 0:
|
||||
#updater.bot.send_message(chat_id = msg.chat.id, text = responce)
|
||||
updater.bot.send_message(chat_id = msg.chat.id, text = responce)
|
||||
print("Responded using module {} ({}) with text: {}".format(mod.path, mod.alias, responce))
|
||||
break
|
||||
|
||||
|
@ -188,6 +189,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