Skip to content

Commit

Permalink
fix: Override pyrabbit client host in production
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Mar 27, 2024
1 parent 56ebafa commit 047c32e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion shapeworks_cloud/manage_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ def inspect_queue(queue_name):
num_messages = -1
with app.pool.acquire(block=True) as conn:
try:
queue = conn.get_manager().get_queue('/', queue_name)
manager = conn.get_manager()
configuration = os.environ.get('DJANGO_CONFIGURATION')
if configuration == 'HerokuProductionConfiguration':
# Override manager hostname in production;
# CloudAMQP management not served through dedicated port
manager = pyrabbit.api.Client(
host=manager.host.replace(':15672', ''),
user=manager.user,
passwd=manager.passwd,
)
queue = manager.get_queue('/', queue_name)
num_messages = queue.get('messages_ready', num_messages)
except pyrabbit.http.HTTPError:
# queue doesn't exist yet, wait for a spawned task to create it
Expand Down

0 comments on commit 047c32e

Please sign in to comment.