Skip to content

Commit

Permalink
Limit rabbitmq prefetch and use default rabbitmq (#180)
Browse files Browse the repository at this point in the history
* Limit rabbitmq prefetch and use default rabbitmq

Shouldn't need to increase the timeout for rabbitmq

* Use default rabbitmq everywhere

* Don't prefetch messages
  • Loading branch information
stefpiatek authored Dec 13, 2023
1 parent a86fbe1 commit 08ac69c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 27 deletions.
6 changes: 1 addition & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,7 @@ services:
restart: "no"

queue:
build:
context: .
dockerfile: ./docker/queue/Dockerfile
args:
<<: *build-args-common
image: rabbitmq:3.11.2-management
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USERNAME}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
Expand Down
16 changes: 0 additions & 16 deletions docker/queue/Dockerfile

This file was deleted.

2 changes: 2 additions & 0 deletions pixl_core/src/core/patient_queue/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ async def __aenter__(self) -> "PixlConsumer":
"""Establishes connection to queue."""
self._connection = await aio_pika.connect_robust(self._url)
self._channel = await self._connection.channel()
# Don't prefetch messages
await self._channel.set_qos(prefetch_count=1)
self._queue = await self._channel.declare_queue(self.queue_name)
return self

Expand Down
3 changes: 0 additions & 3 deletions pixl_core/tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ services:

queue:
container_name: pixl-test-queue
build:
context: ../..
dockerfile: docker/queue/Dockerfile
image: rabbitmq:3.11.2-management
environment:
RABBITMQ_DEFAULT_USER: guest
Expand Down
4 changes: 1 addition & 3 deletions pixl_pacs/tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,7 @@ services:

queue:
container_name: pixl-test-queue
build:
context: ../..
dockerfile: docker/queue/Dockerfile
image: rabbitmq:3.11.2-management
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
Expand Down

0 comments on commit 08ac69c

Please sign in to comment.