1
0
Fork 0

Merge branch 'main' into book-series-v1

This commit is contained in:
Dustin Steiner 2023-01-26 16:36:19 +00:00
commit 5cc158e3be
No known key found for this signature in database
GPG key ID: 918D51522D8CB8F2
11 changed files with 74 additions and 28 deletions

View file

@ -8,12 +8,7 @@ import redis
from celerywyrm import settings
from bookwyrm.tasks import app as celery
r = redis.Redis(
host=settings.REDIS_BROKER_HOST,
port=settings.REDIS_BROKER_PORT,
password=settings.REDIS_BROKER_PASSWORD,
db=settings.REDIS_BROKER_DB_INDEX,
)
r = redis.from_url(settings.REDIS_BROKER_URL)
# pylint: disable= no-self-use
@method_decorator(login_required, name="dispatch")

View file

@ -14,7 +14,7 @@ from django.views import View
from django.views.decorators.csrf import csrf_exempt
from bookwyrm import activitypub, models
from bookwyrm.tasks import app, MEDIUM
from bookwyrm.tasks import app, MEDIUM, HIGH
from bookwyrm.signatures import Signature
from bookwyrm.utils import regex
@ -60,7 +60,11 @@ class Inbox(View):
return HttpResponse()
return HttpResponse(status=401)
activity_task.delay(activity_json)
# Make activities relating to follow/unfollow a high priority
high = ["Follow", "Accept", "Reject", "Block", "Unblock", "Undo"]
priority = HIGH if activity_json["type"] in high else MEDIUM
activity_task.apply_async(args=(activity_json,), queue=priority)
return HttpResponse()