From 660e2a264a0ef321ec72fa28b205b3168efdd253 Mon Sep 17 00:00:00 2001 From: Migatu Date: Tue, 9 Apr 2024 01:38:10 +0200 Subject: [PATCH] Fixed! --- bot.py | 2 +- communication_subroutine.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index e0814da..da8189a 100644 --- a/bot.py +++ b/bot.py @@ -2220,7 +2220,7 @@ if __name__ == "__main__": logger.info("Starting discord bot") threads = [] threads.append(threading.Thread(target=client.run, args=(TOKEN,))) - threads.append(threading.Thread(target=communication_subroutine.comm_subroutine, args=(OUT_COMM_Q,))) + threads.append(threading.Thread(target=communication_subroutine.comm_subroutine, args=(OUT_COMM_Q,IN_COMM_Q))) for worker in threads: worker.start() for worker in threads: diff --git a/communication_subroutine.py b/communication_subroutine.py index 2323543..0298974 100644 --- a/communication_subroutine.py +++ b/communication_subroutine.py @@ -23,9 +23,10 @@ def answer_external_command(): #) #return return_data return jsonify("SUCCESS") + @app.route("/conjurer", methods=["GET"]) def check_alive(): - return jsonify("SUCCESS") + return jsonify("ALIVE") def flask_debug(_logger): """ @@ -45,20 +46,22 @@ def waitress_run(_logger): _logger.info("Attempt waitress") serve(app, host=HOST_ADDRESS, port=PORT_ADDRESS) -def scan_queue(comm_q): +def scan_queue(comm_q,out_queue): while True: data = comm_q.get() print(data) + out_queue.put("Test") -def comm_subroutine(comm_q): - queue = comm_q +def comm_subroutine(in_comm_q, out_com_q): + in_queue = in_comm_q + out_queue = out_com_q logger = logging.getLogger('conjurer_musician') logger.setLevel(logging.DEBUG) logger.info("Started") threads = [] threads.append(threading.Thread(target=waitress_run, args=(logger,))) - threads.append(threading.Thread(target=scan_queue, args=(queue,))) + threads.append(threading.Thread(target=scan_queue, args=(in_queue,out_queue))) for worker in threads: worker.start()