Populate streams tasks

This commit is contained in:
Mouse Reeve
2021-08-07 17:38:07 -07:00
parent 48a8b014ba
commit 590338138c
4 changed files with 30 additions and 7 deletions

View File

@ -4,6 +4,7 @@ from django.db.models import signals, Q
from bookwyrm import models
from bookwyrm.redis_store import RedisStore, r
from bookwyrm.tasks import app
from bookwyrm.views.helpers import privacy_filter
@ -374,3 +375,11 @@ def remove_statuses_on_shelve(sender, instance, *args, **kwargs):
return
BooksStream().remove_book_statuses(instance.user, instance.book)
@app.task
def populate_stream_task(stream, user_id):
"""background task for populating an empty activitystream"""
user = models.User.objects.get(id=user_id)
stream = streams[stream]
stream.populate_streams(user)