mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Make follow activities a high priority
This should go a long way towards fixing the problems with follows not going through to remote servers. All it does is move relationship related activities from the medium priority queue, which gets backlogged easily, to the high priority queue, which is less backlogged. The risk here is that the high priority queue could end up getting backlogged, so this isn't the last word on fixing this, but I think the volume of activities that this will add to it will be manageable.
This commit is contained in:
parent
6425e569c5
commit
858bf70d62
1 changed files with 6 additions and 2 deletions
|
@ -14,7 +14,7 @@ from django.views import View
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from bookwyrm import activitypub, models
|
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.signatures import Signature
|
||||||
from bookwyrm.utils import regex
|
from bookwyrm.utils import regex
|
||||||
|
|
||||||
|
@ -60,7 +60,11 @@ class Inbox(View):
|
||||||
return HttpResponse()
|
return HttpResponse()
|
||||||
return HttpResponse(status=401)
|
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()
|
return HttpResponse()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue