mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-13 14:30:17 +02:00
Fix issue causing queue length query to hang
This commit is contained in:
parent
6baab1d006
commit
f97c8f2ce4
@ -0,0 +1 @@
|
||||
from .celery import app as celery_app
|
@ -1,5 +1,6 @@
|
||||
import requests
|
||||
import logging
|
||||
import amqp.exceptions
|
||||
import semantic_version as semver
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
@ -54,6 +55,9 @@ def get_celery_queue_length():
|
||||
with app.connection_or_acquire() as conn:
|
||||
return conn.default_channel.queue_declare(
|
||||
queue=getattr(settings, 'CELERY_DEFAULT_QUEUE', 'celery'), passive=True).message_count
|
||||
except amqp.exceptions.ChannelError:
|
||||
# Queue doesn't exist, probably empty
|
||||
return 0
|
||||
except Exception:
|
||||
logger.exception("Failed to get celery queue length")
|
||||
return -1
|
||||
|
Loading…
x
Reference in New Issue
Block a user