From 0b45709b0fd5973dd85d53089c8c3f2f3abf60e0 Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 21 Jun 2017 15:18:27 +0200 Subject: support dynamic queue names --- worker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'worker.py') diff --git a/worker.py b/worker.py index 47e7d95..5854411 100644 --- a/worker.py +++ b/worker.py @@ -17,6 +17,7 @@ DATABASE_URI = os.environ["DATABASE_URI"] 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" # mapping from Tier (-1 - 30) to average skill tier points vst_points = { @@ -105,9 +106,9 @@ def connect(): logging.error(err) time.sleep(5) channel = rabbit.channel() - channel.queue_declare(queue="analyze", durable=True) + channel.queue_declare(queue=QUEUE, durable=True) channel.basic_qos(prefetch_count=BATCHSIZE) - channel.basic_consume(newjob, queue="analyze") + channel.basic_consume(newjob, queue=QUEUE) def newjob(_, method, properties, body): -- cgit v1.3.1