forked from CGM_Public/pretix_original
The current implementation only works if redis is used as broker. Otherwise it would throw an Exception, which causes a 500 to be returend. Now we just don't have celery metrics in those cases. Fixes #2029
This commit is contained in:
@@ -286,7 +286,9 @@ def metric_values():
|
||||
metrics['pretix_model_instances']['{model="%s"}' % m._meta] = estimate_count_fast(m)
|
||||
|
||||
if settings.HAS_CELERY:
|
||||
client = app.broker_connection().channel().client
|
||||
channel = app.broker_connection().channel()
|
||||
if hasattr(channel, 'client') and channel.client is not None:
|
||||
client = channel.client
|
||||
for q in settings.CELERY_TASK_QUEUES:
|
||||
llen = client.llen(q.name)
|
||||
lfirst = client.lindex(q.name, -1)
|
||||
|
||||
Reference in New Issue
Block a user