Move build queue out of global processors
parent
93a34b4640
commit
c7f3e136de
|
@ -1,10 +1,13 @@
|
|||
from django.shortcuts import get_object_or_404
|
||||
from django.views.generic import ListView, DetailView
|
||||
from django.conf import settings
|
||||
|
||||
from builds.models import Build, Version
|
||||
from builds.filters import BuildFilter
|
||||
from projects.models import Project
|
||||
|
||||
from redis import Redis, ConnectionError
|
||||
|
||||
|
||||
class BuildList(ListView):
|
||||
model = Build
|
||||
|
@ -30,6 +33,13 @@ class BuildList(ListView):
|
|||
context['filter'] = filter
|
||||
context['active_builds'] = active_builds
|
||||
context['versions'] = Version.objects.public(user=self.request.user, project=self.project)
|
||||
|
||||
try:
|
||||
redis = Redis(**settings.REDIS)
|
||||
context['queue_length'] = redis.llen('celery')
|
||||
except ConnectionError:
|
||||
context['queue_length'] = None
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
from django.conf import settings
|
||||
from redis import Redis, ConnectionError
|
||||
|
||||
redis = Redis(**settings.REDIS)
|
||||
|
||||
def readthedocs_processor(request):
|
||||
try:
|
||||
queue_length = redis.llen('celery')
|
||||
except ConnectionError:
|
||||
queue_length = None
|
||||
|
||||
exports = {
|
||||
'BUILD_QUEUE_DEPTH': queue_length,
|
||||
'PRODUCTION_DOMAIN': getattr(settings, 'PRODUCTION_DOMAIN', None),
|
||||
'USE_SUBDOMAINS': getattr(settings, 'USE_SUBDOMAINS', None),
|
||||
'GLOBAL_ANALYTICS_CODE': getattr(settings, 'GLOBAL_ANALYTICS_CODE', 'UA-17997319-1'),
|
||||
|
|
|
@ -31,10 +31,10 @@ Filters
|
|||
|
||||
|
||||
<!-- BEGIN queue depth warning -->
|
||||
{% if BUILD_QUEUE_DEPTH > 10 %}
|
||||
{% if queue_length > 10 %}
|
||||
<div>
|
||||
<p>
|
||||
{% blocktrans with BUILD_QUEUE_DEPTH as queue_length %}
|
||||
{% blocktrans with queue_length as queue_length %}
|
||||
Whoa! The build queue is {{ queue_length }} tasks long, new builds may take a while.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue