prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
   Celery queue names inconsistent
  **Is your feature request related to a problem? Please describe.**
  In the admin interface, the Celery Status tab shows all the current queues.
  They seemed to be only ever-increasing recently, so I had to look into why that happened.
  After a lot of wasting of time, I figured out how to properly get into Flower, (and how to start it...)
  Here, I discovered that the Celery worker was ignoring all but four of the queues, so I had to manually add them.
  This did not really seem to be a problem. However, when I entered `broadcasts`, as that is what the queue is named in the admin interface, nothing happened. An investigation later I found out that the queue was actually called `broadcast`, singular.
  
  **Describe the solution you'd like**
  So, please fix that. Either change the name of the queue, or change it in the admin interface, so that someone can look at the admin interface to know what the queue names are...
  
  **Describe alternatives you've considered**
  N/A
  
  **Additional context**
  N/A
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bookwyrm/views/admin/celery_status.py`
  Content:
  ```
  1 """ celery status """
  2 import json
  3 
  4 from django.contrib.auth.decorators import login_required, permission_required
  5 from django.http import HttpResponse
  6 from django.template.response import TemplateResponse
  7 from django.utils.decorators import method_decorator
  8 from django.views import View
  9 from django.views.decorators.http import require_GET
  10 from django import forms
  11 import redis
  12 
  13 from celerywyrm import settings
  14 from bookwyrm.tasks import (
  15     app as celery,
  16     LOW,
  17     MEDIUM,
  18     HIGH,
  19     STREAMS,
  20     IMAGES,
  21     SUGGESTED_USERS,
  22     EMAIL,
  23     CONNECTORS,
  24     LISTS,
  25     INBOX,
  26     IMPORTS,
  27     IMPORT_TRIGGERED,
  28     BROADCAST,
  29     MISC,
  30 )
  31 
  32 r = redis.from_url(settings.REDIS_BROKER_URL)
  33 
  34 # pylint: disable= no-self-use
  35 @method_decorator(login_required, name="dispatch")
  36 @method_decorator(
  37     permission_required("bookwyrm.edit_instance_settings", raise_exception=True),
  38     name="dispatch",
  39 )
  40 class CeleryStatus(View):
  41     """Are your tasks running? Well you'd better go catch them"""
  42 
  43     def get(self, request):
  44         """See workers and active tasks"""
  45         errors = []
  46         try:
  47             inspect = celery.control.inspect()
  48             stats = inspect.stats()
  49             active_tasks = inspect.active()
  50         # pylint: disable=broad-except
  51         except Exception as err:
  52             stats = active_tasks = None
  53             errors.append(err)
  54 
  55         try:
  56             queues = {
  57                 LOW: r.llen(LOW),
  58                 MEDIUM: r.llen(MEDIUM),
  59                 HIGH: r.llen(HIGH),
  60                 STREAMS: r.llen(STREAMS),
  61                 IMAGES: r.llen(IMAGES),
  62                 SUGGESTED_USERS: r.llen(SUGGESTED_USERS),
  63                 EMAIL: r.llen(EMAIL),
  64                 CONNECTORS: r.llen(CONNECTORS),
  65                 LISTS: r.llen(LISTS),
  66                 INBOX: r.llen(INBOX),
  67                 IMPORTS: r.llen(IMPORTS),
  68                 IMPORT_TRIGGERED: r.llen(IMPORT_TRIGGERED),
  69                 BROADCAST: r.llen(BROADCAST),
  70                 MISC: r.llen(MISC),
  71             }
  72         # pylint: disable=broad-except
  73         except Exception as err:
  74             queues = None
  75             errors.append(err)
  76 
  77         form = ClearCeleryForm()
  78 
  79         data = {
  80             "stats": stats,
  81             "active_tasks": active_tasks,
  82             "queues": queues,
  83             "form": form,
  84             "errors": errors,
  85         }
  86         return TemplateResponse(request, "settings/celery.html", data)
  87 
  88     def post(self, request):
  89         """Submit form to clear queues"""
  90         form = ClearCeleryForm(request.POST)
  91         if form.is_valid():
  92             if len(celery.control.ping()) != 0:
  93                 return HttpResponse(
  94                     "Refusing to delete tasks while Celery worker is active"
  95                 )
  96             pipeline = r.pipeline()
  97             for queue in form.cleaned_data["queues"]:
  98                 for task in r.lrange(queue, 0, -1):
  99                     task_json = json.loads(task)
  100                     if task_json["headers"]["task"] in form.cleaned_data["tasks"]:
  101                         pipeline.lrem(queue, 0, task)
  102             results = pipeline.execute()
  103 
  104         return HttpResponse(f"Deleted {sum(results)} tasks")
  105 
  106 
  107 class ClearCeleryForm(forms.Form):
  108     """Form to clear queues"""
  109 
  110     queues = forms.MultipleChoiceField(
  111         label="Queues",
  112         choices=[
  113             (LOW, "Low prioirty"),
  114             (MEDIUM, "Medium priority"),
  115             (HIGH, "High priority"),
  116             (STREAMS, "Streams"),
  117             (IMAGES, "Images"),
  118             (SUGGESTED_USERS, "Suggested users"),
  119             (EMAIL, "Email"),
  120             (CONNECTORS, "Connectors"),
  121             (LISTS, "Lists"),
  122             (INBOX, "Inbox"),
  123             (IMPORTS, "Imports"),
  124             (IMPORT_TRIGGERED, "Import triggered"),
  125             (BROADCAST, "Broadcasts"),
  126             (MISC, "Misc"),
  127         ],
  128         widget=forms.CheckboxSelectMultiple,
  129     )
  130     tasks = forms.MultipleChoiceField(
  131         label="Tasks", choices=[], widget=forms.CheckboxSelectMultiple
  132     )
  133 
  134     def __init__(self, *args, **kwargs):
  135         super().__init__(*args, **kwargs)
  136         celery.loader.import_default_modules()
  137         self.fields["tasks"].choices = sorted(
  138             [(k, k) for k in celery.tasks.keys() if not k.startswith("celery.")]
  139         )
  140 
  141 
  142 @require_GET
  143 # pylint: disable=unused-argument
  144 def celery_ping(request):
  145     """Just tells you if Celery is on or not"""
  146     try:
  147         ping = celery.control.inspect().ping()
  148         if ping:
  149             return HttpResponse()
  150     # pylint: disable=broad-except
  151     except Exception:
  152         pass
  153 
  154     return HttpResponse(status=500)
  155
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bookwyrm/views/admin/celery_status.py b/bookwyrm/views/admin/celery_status.py
  --- a/bookwyrm/views/admin/celery_status.py
  +++ b/bookwyrm/views/admin/celery_status.py
  @@ -110,20 +110,20 @@
       queues = forms.MultipleChoiceField(
           label="Queues",
           choices=[
  -            (LOW, "Low prioirty"),
  +            (LOW, "Low priority"),
               (MEDIUM, "Medium priority"),
               (HIGH, "High priority"),
  -            (STREAMS, "Streams"),
  -            (IMAGES, "Images"),
  -            (SUGGESTED_USERS, "Suggested users"),
  -            (EMAIL, "Email"),
  +            (BROADCAST, "Broadcast"),
               (CONNECTORS, "Connectors"),
  -            (LISTS, "Lists"),
  -            (INBOX, "Inbox"),
  +            (EMAIL, "Email"),
  +            (IMAGES, "Images"),
               (IMPORTS, "Imports"),
               (IMPORT_TRIGGERED, "Import triggered"),
  -            (BROADCAST, "Broadcasts"),
  +            (INBOX, "Inbox"),
  +            (LISTS, "Lists"),
               (MISC, "Misc"),
  +            (STREAMS, "Streams"),
  +            (SUGGESTED_USERS, "Suggested users"),
           ],
           widget=forms.CheckboxSelectMultiple,
       )
  
verification_info: {"golden_diff": "diff --git a/bookwyrm/views/admin/celery_status.py b/bookwyrm/views/admin/celery_status.py\n--- a/bookwyrm/views/admin/celery_status.py\n+++ b/bookwyrm/views/admin/celery_status.py\n@@ -110,20 +110,20 @@\n     queues = forms.MultipleChoiceField(\n         label=\"Queues\",\n         choices=[\n-            (LOW, \"Low prioirty\"),\n+            (LOW, \"Low priority\"),\n             (MEDIUM, \"Medium priority\"),\n             (HIGH, \"High priority\"),\n-            (STREAMS, \"Streams\"),\n-            (IMAGES, \"Images\"),\n-            (SUGGESTED_USERS, \"Suggested users\"),\n-            (EMAIL, \"Email\"),\n+            (BROADCAST, \"Broadcast\"),\n             (CONNECTORS, \"Connectors\"),\n-            (LISTS, \"Lists\"),\n-            (INBOX, \"Inbox\"),\n+            (EMAIL, \"Email\"),\n+            (IMAGES, \"Images\"),\n             (IMPORTS, \"Imports\"),\n             (IMPORT_TRIGGERED, \"Import triggered\"),\n-            (BROADCAST, \"Broadcasts\"),\n+            (INBOX, \"Inbox\"),\n+            (LISTS, \"Lists\"),\n             (MISC, \"Misc\"),\n+            (STREAMS, \"Streams\"),\n+            (SUGGESTED_USERS, \"Suggested users\"),\n         ],\n         widget=forms.CheckboxSelectMultiple,\n     )\n", "issue": " Celery queue names inconsistent\n**Is your feature request related to a problem? Please describe.**\r\nIn the admin interface, the Celery Status tab shows all the current queues.\r\nThey seemed to be only ever-increasing recently, so I had to look into why that happened.\r\nAfter a lot of wasting of time, I figured out how to properly get into Flower, (and how to start it...)\r\nHere, I discovered that the Celery worker was ignoring all but four of the queues, so I had to manually add them.\r\nThis did not really seem to be a problem. However, when I entered `broadcasts`, as that is what the queue is named in the admin interface, nothing happened. An investigation later I found out that the queue was actually called `broadcast`, singular.\r\n\r\n**Describe the solution you'd like**\r\nSo, please fix that. Either change the name of the queue, or change it in the admin interface, so that someone can look at the admin interface to know what the queue names are...\r\n\r\n**Describe alternatives you've considered**\r\nN/A\r\n\r\n**Additional context**\r\nN/A\r\n\n", "before_files": [{"content": "\"\"\" celery status \"\"\"\nimport json\n\nfrom django.contrib.auth.decorators import login_required, permission_required\nfrom django.http import HttpResponse\nfrom django.template.response import TemplateResponse\nfrom django.utils.decorators import method_decorator\nfrom django.views import View\nfrom django.views.decorators.http import require_GET\nfrom django import forms\nimport redis\n\nfrom celerywyrm import settings\nfrom bookwyrm.tasks import (\n    app as celery,\n    LOW,\n    MEDIUM,\n    HIGH,\n    STREAMS,\n    IMAGES,\n    SUGGESTED_USERS,\n    EMAIL,\n    CONNECTORS,\n    LISTS,\n    INBOX,\n    IMPORTS,\n    IMPORT_TRIGGERED,\n    BROADCAST,\n    MISC,\n)\n\nr = redis.from_url(settings.REDIS_BROKER_URL)\n\n# pylint: disable= no-self-use\n@method_decorator(login_required, name=\"dispatch\")\n@method_decorator(\n    permission_required(\"bookwyrm.edit_instance_settings\", raise_exception=True),\n    name=\"dispatch\",\n)\nclass CeleryStatus(View):\n    \"\"\"Are your tasks running? Well you'd better go catch them\"\"\"\n\n    def get(self, request):\n        \"\"\"See workers and active tasks\"\"\"\n        errors = []\n        try:\n            inspect = celery.control.inspect()\n            stats = inspect.stats()\n            active_tasks = inspect.active()\n        # pylint: disable=broad-except\n        except Exception as err:\n            stats = active_tasks = None\n            errors.append(err)\n\n        try:\n            queues = {\n                LOW: r.llen(LOW),\n                MEDIUM: r.llen(MEDIUM),\n                HIGH: r.llen(HIGH),\n                STREAMS: r.llen(STREAMS),\n                IMAGES: r.llen(IMAGES),\n                SUGGESTED_USERS: r.llen(SUGGESTED_USERS),\n                EMAIL: r.llen(EMAIL),\n                CONNECTORS: r.llen(CONNECTORS),\n                LISTS: r.llen(LISTS),\n                INBOX: r.llen(INBOX),\n                IMPORTS: r.llen(IMPORTS),\n                IMPORT_TRIGGERED: r.llen(IMPORT_TRIGGERED),\n                BROADCAST: r.llen(BROADCAST),\n                MISC: r.llen(MISC),\n            }\n        # pylint: disable=broad-except\n        except Exception as err:\n            queues = None\n            errors.append(err)\n\n        form = ClearCeleryForm()\n\n        data = {\n            \"stats\": stats,\n            \"active_tasks\": active_tasks,\n            \"queues\": queues,\n            \"form\": form,\n            \"errors\": errors,\n        }\n        return TemplateResponse(request, \"settings/celery.html\", data)\n\n    def post(self, request):\n        \"\"\"Submit form to clear queues\"\"\"\n        form = ClearCeleryForm(request.POST)\n        if form.is_valid():\n            if len(celery.control.ping()) != 0:\n                return HttpResponse(\n                    \"Refusing to delete tasks while Celery worker is active\"\n                )\n            pipeline = r.pipeline()\n            for queue in form.cleaned_data[\"queues\"]:\n                for task in r.lrange(queue, 0, -1):\n                    task_json = json.loads(task)\n                    if task_json[\"headers\"][\"task\"] in form.cleaned_data[\"tasks\"]:\n                        pipeline.lrem(queue, 0, task)\n            results = pipeline.execute()\n\n        return HttpResponse(f\"Deleted {sum(results)} tasks\")\n\n\nclass ClearCeleryForm(forms.Form):\n    \"\"\"Form to clear queues\"\"\"\n\n    queues = forms.MultipleChoiceField(\n        label=\"Queues\",\n        choices=[\n            (LOW, \"Low prioirty\"),\n            (MEDIUM, \"Medium priority\"),\n            (HIGH, \"High priority\"),\n            (STREAMS, \"Streams\"),\n            (IMAGES, \"Images\"),\n            (SUGGESTED_USERS, \"Suggested users\"),\n            (EMAIL, \"Email\"),\n            (CONNECTORS, \"Connectors\"),\n            (LISTS, \"Lists\"),\n            (INBOX, \"Inbox\"),\n            (IMPORTS, \"Imports\"),\n            (IMPORT_TRIGGERED, \"Import triggered\"),\n            (BROADCAST, \"Broadcasts\"),\n            (MISC, \"Misc\"),\n        ],\n        widget=forms.CheckboxSelectMultiple,\n    )\n    tasks = forms.MultipleChoiceField(\n        label=\"Tasks\", choices=[], widget=forms.CheckboxSelectMultiple\n    )\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        celery.loader.import_default_modules()\n        self.fields[\"tasks\"].choices = sorted(\n            [(k, k) for k in celery.tasks.keys() if not k.startswith(\"celery.\")]\n        )\n\n\n@require_GET\n# pylint: disable=unused-argument\ndef celery_ping(request):\n    \"\"\"Just tells you if Celery is on or not\"\"\"\n    try:\n        ping = celery.control.inspect().ping()\n        if ping:\n            return HttpResponse()\n    # pylint: disable=broad-except\n    except Exception:\n        pass\n\n    return HttpResponse(status=500)\n", "path": "bookwyrm/views/admin/celery_status.py"}], "after_files": [{"content": "\"\"\" celery status \"\"\"\nimport json\n\nfrom django.contrib.auth.decorators import login_required, permission_required\nfrom django.http import HttpResponse\nfrom django.template.response import TemplateResponse\nfrom django.utils.decorators import method_decorator\nfrom django.views import View\nfrom django.views.decorators.http import require_GET\nfrom django import forms\nimport redis\n\nfrom celerywyrm import settings\nfrom bookwyrm.tasks import (\n    app as celery,\n    LOW,\n    MEDIUM,\n    HIGH,\n    STREAMS,\n    IMAGES,\n    SUGGESTED_USERS,\n    EMAIL,\n    CONNECTORS,\n    LISTS,\n    INBOX,\n    IMPORTS,\n    IMPORT_TRIGGERED,\n    BROADCAST,\n    MISC,\n)\n\nr = redis.from_url(settings.REDIS_BROKER_URL)\n\n# pylint: disable= no-self-use\n@method_decorator(login_required, name=\"dispatch\")\n@method_decorator(\n    permission_required(\"bookwyrm.edit_instance_settings\", raise_exception=True),\n    name=\"dispatch\",\n)\nclass CeleryStatus(View):\n    \"\"\"Are your tasks running? Well you'd better go catch them\"\"\"\n\n    def get(self, request):\n        \"\"\"See workers and active tasks\"\"\"\n        errors = []\n        try:\n            inspect = celery.control.inspect()\n            stats = inspect.stats()\n            active_tasks = inspect.active()\n        # pylint: disable=broad-except\n        except Exception as err:\n            stats = active_tasks = None\n            errors.append(err)\n\n        try:\n            queues = {\n                LOW: r.llen(LOW),\n                MEDIUM: r.llen(MEDIUM),\n                HIGH: r.llen(HIGH),\n                STREAMS: r.llen(STREAMS),\n                IMAGES: r.llen(IMAGES),\n                SUGGESTED_USERS: r.llen(SUGGESTED_USERS),\n                EMAIL: r.llen(EMAIL),\n                CONNECTORS: r.llen(CONNECTORS),\n                LISTS: r.llen(LISTS),\n                INBOX: r.llen(INBOX),\n                IMPORTS: r.llen(IMPORTS),\n                IMPORT_TRIGGERED: r.llen(IMPORT_TRIGGERED),\n                BROADCAST: r.llen(BROADCAST),\n                MISC: r.llen(MISC),\n            }\n        # pylint: disable=broad-except\n        except Exception as err:\n            queues = None\n            errors.append(err)\n\n        form = ClearCeleryForm()\n\n        data = {\n            \"stats\": stats,\n            \"active_tasks\": active_tasks,\n            \"queues\": queues,\n            \"form\": form,\n            \"errors\": errors,\n        }\n        return TemplateResponse(request, \"settings/celery.html\", data)\n\n    def post(self, request):\n        \"\"\"Submit form to clear queues\"\"\"\n        form = ClearCeleryForm(request.POST)\n        if form.is_valid():\n            if len(celery.control.ping()) != 0:\n                return HttpResponse(\n                    \"Refusing to delete tasks while Celery worker is active\"\n                )\n            pipeline = r.pipeline()\n            for queue in form.cleaned_data[\"queues\"]:\n                for task in r.lrange(queue, 0, -1):\n                    task_json = json.loads(task)\n                    if task_json[\"headers\"][\"task\"] in form.cleaned_data[\"tasks\"]:\n                        pipeline.lrem(queue, 0, task)\n            results = pipeline.execute()\n\n        return HttpResponse(f\"Deleted {sum(results)} tasks\")\n\n\nclass ClearCeleryForm(forms.Form):\n    \"\"\"Form to clear queues\"\"\"\n\n    queues = forms.MultipleChoiceField(\n        label=\"Queues\",\n        choices=[\n            (LOW, \"Low priority\"),\n            (MEDIUM, \"Medium priority\"),\n            (HIGH, \"High priority\"),\n            (BROADCAST, \"Broadcast\"),\n            (CONNECTORS, \"Connectors\"),\n            (EMAIL, \"Email\"),\n            (IMAGES, \"Images\"),\n            (IMPORTS, \"Imports\"),\n            (IMPORT_TRIGGERED, \"Import triggered\"),\n            (INBOX, \"Inbox\"),\n            (LISTS, \"Lists\"),\n            (MISC, \"Misc\"),\n            (STREAMS, \"Streams\"),\n            (SUGGESTED_USERS, \"Suggested users\"),\n        ],\n        widget=forms.CheckboxSelectMultiple,\n    )\n    tasks = forms.MultipleChoiceField(\n        label=\"Tasks\", choices=[], widget=forms.CheckboxSelectMultiple\n    )\n\n    def __init__(self, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n        celery.loader.import_default_modules()\n        self.fields[\"tasks\"].choices = sorted(\n            [(k, k) for k in celery.tasks.keys() if not k.startswith(\"celery.\")]\n        )\n\n\n@require_GET\n# pylint: disable=unused-argument\ndef celery_ping(request):\n    \"\"\"Just tells you if Celery is on or not\"\"\"\n    try:\n        ping = celery.control.inspect().ping()\n        if ping:\n            return HttpResponse()\n    # pylint: disable=broad-except\n    except Exception:\n        pass\n\n    return HttpResponse(status=500)\n", "path": "bookwyrm/views/admin/celery_status.py"}]}