Repository: readthedocs/readthedocs.org
Issue: Bug in core.views.queue_info, is it used anymore?

The code in `core.views.queue_info` contains this:

``` python
            for obj in reserved['build']:
                kwrags = eval(obj['kwargs'])
                reserved_pks.append(str(kwargs['pk']))
```

So it has a typo in `kwrags`. That means the third line of the example won't pick up the correct variable. It might still succeed without a `NameError` as it might be already initialized by another for loop above in the same function.

See https://github.com/rtfd/readthedocs.org/blob/291d7d61e626c1dfb998d9e5d4e5b734a44a7024/readthedocs/core/views.py#L102

I didn't fix it straight away as it seems that the `queue_info` URL is not used anywhere in the project? Do we still have a use for it?

```
$ grep -r queue_info .
./readthedocs/core/views.py:def queue_info(request):
./readthedocs/urls.py:    url(r'^queue_info/$', 'readthedocs.core.views.queue_info', name='queue_info'),
```


Changed files:
readthedocs/core/management/commands/pull.py, readthedocs/core/views.py, readthedocs/urls.py

diff --git a/readthedocs/core/management/commands/pull.py b/readthedocs/core/management/commands/pull.py
index 29fa4b914..cc563e406 100644
--- a/readthedocs/core/management/commands/pull.py
+++ b/readthedocs/core/management/commands/pull.py
@@ -6,7 +6,6 @@ from django.conf import settings
 from readthedocs.builds.constants import LATEST
 from readthedocs.projects import tasks, utils
 
-import redis
 
 log = logging.getLogger(__name__)
 
diff --git a/readthedocs/core/views.py b/readthedocs/core/views.py
index e853d4931..3e72f1412 100644
--- a/readthedocs/core/views.py
+++ b/readthedocs/core/views.py
@@ -16,7 +16,6 @@ from django.views.generic import TemplateView
 
 from haystack.query import EmptySearchQuerySet
 from haystack.query import SearchQuerySet
-from celery.task.control import inspect  # noqa: pylint false positive
 import stripe
 
 from readthedocs.builds.models import Build
@@ -35,7 +34,6 @@ import json
 import mimetypes
 import os
 import logging
-import redis
 import re
 
 log = logging.getLogger(__name__)
@@ -77,42 +75,6 @@ def random_page(request, project_slug=None):
     return HttpResponseRedirect(url)
 
 
-def queue_depth(request):
-    r = redis.Redis(**settings.REDIS)
-    return HttpResponse(r.llen('celery'))
-
-
-def queue_info(request):
-    i = inspect()
-    active_pks = []
-    reserved_pks = []
-    resp = ""
-
-    active = i.active()
-    if active:
-        try:
-            for obj in active['build']:
-                kwargs = eval(obj['kwargs'])
-                active_pks.append(str(kwargs['pk']))
-            active_resp = "Active: %s  " % " ".join(active_pks)
-            resp += active_resp
-        except Exception, e:
-            resp += str(e)
-
-    reserved = i.reserved()
-    if reserved:
-        try:
-            for obj in reserved['build']:
-                kwrags = eval(obj['kwargs'])
-                reserved_pks.append(str(kwargs['pk']))
-            reserved_resp = " | Reserved: %s" % " ".join(reserved_pks)
-            resp += reserved_resp
-        except Exception, e:
-            resp += str(e)
-
-    return HttpResponse(resp)
-
-
 def live_builds(request):
     builds = Build.objects.filter(state='building')[:5]
     websocket_host = getattr(settings, 'WEBSOCKET_HOST', 'localhost:8088')
diff --git a/readthedocs/urls.py b/readthedocs/urls.py
index fb61c2228..9af043062 100644
--- a/readthedocs/urls.py
+++ b/readthedocs/urls.py
@@ -111,8 +111,6 @@ urlpatterns = patterns(
         name='random_page'),
     url(r'^random/$', 'readthedocs.core.views.random_page', name='random_page'),
     url(r'^sustainability/', include('readthedocs.donate.urls')),
-    url(r'^depth/$', 'readthedocs.core.views.queue_depth', name='queue_depth'),
-    url(r'^queue_info/$', 'readthedocs.core.views.queue_info', name='queue_info'),
     url(r'^live/$', 'readthedocs.core.views.live_builds', name='live_builds'),
     url(r'^500/$', 'readthedocs.core.views.divide_by_zero', name='divide_by_zero'),
     url(r'^filter/version/$',