From 592f26af203776917d34cc315517ebc87272b093 Mon Sep 17 00:00:00 2001 From: tanshu Date: Fri, 19 Mar 2021 06:54:55 +0530 Subject: [PATCH] Fix: The server was also using the worker settings to communicate with redis. This led to it using the default host and port as the backend .env files do not contain worker settings. --- barker/barker/core/arq.py | 2 +- barker/barker/core/arq_worker.py | 5 +++++ barker/barker/worker.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 barker/barker/core/arq_worker.py diff --git a/barker/barker/core/arq.py b/barker/barker/core/arq.py index 6d60e32..93c21c6 100644 --- a/barker/barker/core/arq.py +++ b/barker/barker/core/arq.py @@ -2,4 +2,4 @@ from arq.connections import RedisSettings from barker.core.config import settings as sett -settings = RedisSettings(host=sett.WORKER_REDIS_HOST, port=sett.WORKER_REDIS_PORT) +settings = RedisSettings(host=sett.REDIS_HOST, port=sett.REDIS_PORT) diff --git a/barker/barker/core/arq_worker.py b/barker/barker/core/arq_worker.py new file mode 100644 index 0000000..6d60e32 --- /dev/null +++ b/barker/barker/core/arq_worker.py @@ -0,0 +1,5 @@ +from arq.connections import RedisSettings +from barker.core.config import settings as sett + + +settings = RedisSettings(host=sett.WORKER_REDIS_HOST, port=sett.WORKER_REDIS_PORT) diff --git a/barker/barker/worker.py b/barker/barker/worker.py index 0f178da..fbcfdef 100644 --- a/barker/barker/worker.py +++ b/barker/barker/worker.py @@ -4,7 +4,7 @@ from aiohttp import ClientSession from barker.core.config import settings as sett from barker.tasks.printing import sent_to_printer -from .core.arq import settings +from .core.arq_worker import settings sys.path.extend(["./"]) @@ -13,7 +13,7 @@ sys.path.extend(["./"]) async def startup(ctx): ctx["session"] = ClientSession() print(f"Worker listening for: {sett.WORKER_QUEUE_NAME}") - print(f"Worker printing on: {sett.WORKER_PRINTER_ADDRESS}") + # print(f"Worker printing on: {sett.WORKER_PRINTER_ADDRESS}") async def shutdown(ctx):