summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-07-25 15:36:16 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-07-25 15:36:16 +0200
commitb39de08e3621a14114dc5ffe6ec9ce994b8d324c (patch)
tree88699a85d863559734ac516d11ba78ddf8f202c4
parentce37668d805443571987ef06d12907b401bb395a (diff)
downloadanalyzer-b39de08e3621a14114dc5ffe6ec9ce994b8d324c.tar.gz
analyzer-b39de08e3621a14114dc5ffe6ec9ce994b8d324c.zip
forward participations to cruncher
-rw-r--r--worker.py12
1 files changed, 10 insertions, 2 deletions
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 = []