This commit is contained in:
2024-04-09 01:38:10 +02:00
parent a75daccf9f
commit 660e2a264a
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -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:
+8 -5
View File
@@ -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()