mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 04:51:11 +00:00
b167364c5c
I think this will go a long way to solve the federation delay problems we're seeing on b.s. I'm not sure at what point adding more queues will create more problems than it solves, but I do think in this case the queues are out of balance and moving broadcasts (which are the most common type of `medium_priority` task at the moment) to their own queue will be an improvement.
20 lines
595 B
Python
20 lines
595 B
Python
""" background tasks """
|
|
import os
|
|
from celery import Celery
|
|
|
|
from celerywyrm import settings
|
|
|
|
# set the default Django settings module for the 'celery' program.
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "celerywyrm.settings")
|
|
app = Celery(
|
|
"tasks", broker=settings.CELERY_BROKER_URL, backend=settings.CELERY_RESULT_BACKEND
|
|
)
|
|
|
|
# priorities
|
|
LOW = "low_priority"
|
|
MEDIUM = "medium_priority"
|
|
HIGH = "high_priority"
|
|
# import items get their own queue because they're such a pain in the ass
|
|
IMPORTS = "imports"
|
|
# I keep making more queues?? this one broadcasting out
|
|
BROADCAST = "broadcast"
|