1
0
Fork 0

Adds management and bw-dev commands

This commit is contained in:
Mouse Reeve 2021-11-16 10:41:08 -08:00
parent 1d28c7e73d
commit 903aaaf4c4
3 changed files with 41 additions and 2 deletions

View file

@ -1,18 +1,20 @@
""" Re-create user streams """
from django.core.management.base import BaseCommand
from bookwyrm import activitystreams, models
from bookwyrm import activitystreams, lists_stream, models
def populate_streams(stream=None):
"""build all the streams for all the users"""
streams = [stream] if stream else activitystreams.streams.keys()
print("Populations streams", streams)
print("Populating streams", streams)
users = models.User.objects.filter(
local=True,
is_active=True,
).order_by("-last_active_date")
print("This may take a long time! Please be patient.")
for user in users:
print(".", end="")
lists_stream.populate_lists_stream_task.delay(user.id)
for stream_key in streams:
print(".", end="")
activitystreams.populate_stream_task.delay(stream_key, user.id)