Separates erase and populate stream comands
This commit is contained in:
parent
b377c5bc22
commit
5441d4db09
2 changed files with 29 additions and 12 deletions
30
bookwyrm/management/commands/populate_streams.py
Normal file
30
bookwyrm/management/commands/populate_streams.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
""" Re-create user streams """
|
||||
from django.core.management.base import BaseCommand
|
||||
import redis
|
||||
|
||||
from bookwyrm import activitystreams, models, settings
|
||||
|
||||
r = redis.Redis(
|
||||
host=settings.REDIS_ACTIVITY_HOST, port=settings.REDIS_ACTIVITY_PORT, db=0
|
||||
)
|
||||
|
||||
|
||||
def populate_streams():
|
||||
""" build all the streams for all the users """
|
||||
users = models.User.objects.filter(
|
||||
local=True,
|
||||
is_active=True,
|
||||
)
|
||||
for user in users:
|
||||
for stream in activitystreams.streams.values():
|
||||
stream.populate_stream(user)
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
""" start all over with user streams """
|
||||
|
||||
help = "Populate streams for all users"
|
||||
# pylint: disable=no-self-use,unused-argument
|
||||
def handle(self, *args, **options):
|
||||
""" run feed builder """
|
||||
populate_streams()
|
Loading…
Add table
Add a link
Reference in a new issue