From b39de08e3621a14114dc5ffe6ec9ce994b8d324c Mon Sep 17 00:00:00 2001 From: schneefux Date: Tue, 25 Jul 2017 15:36:16 +0200 Subject: forward participations to cruncher --- worker.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'worker.py') diff --git a/worker.py b/worker.py index 80600bc..5b7cd57 100644 --- a/worker.py +++ b/worker.py @@ -20,6 +20,8 @@ BATCHSIZE = int(os.environ.get("BATCHSIZE") or 500) # matches CHUNKSIZE = int(os.environ.get("CHUNKSIZE") or 100) # matches IDLE_TIMEOUT = float(os.environ.get("IDLE_TIMEOUT") or 1) # s QUEUE = os.environ.get("QUEUE") or "analyze" +DOCRUNCHMATCH = os.environ.get("DOCRUNCHMATCH") == "true" +CRUNCH_PLAYER_QUEUE = os.environ.get("CRUNCH_PLAYER_QUEUE") or "crunch_player" # mapping from Tier (-1 - 30) to average skill tier points vst_points = { @@ -128,8 +130,14 @@ def try_process(): return logging.info("acking batch") - for q in queue: - channel.basic_ack(q[0].delivery_tag) + for meth, prop, body in queue: + channel.basic_ack(meth.delivery_tag) + if DOCRUNCHMATCH: + # forward to cruncher + channel.basic_publish(exchange="", + routing_key=CRUNCH_PLAYER_QUEUE, + body=body, + properties=prop) queue = [] -- cgit v1.3.1