2021-03-28 18:38:39 +00:00
|
|
|
""" Delete user streams """
|
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
import redis
|
|
|
|
|
|
|
|
from bookwyrm import settings
|
|
|
|
|
|
|
|
r = redis.Redis(
|
2022-01-13 05:46:51 +00:00
|
|
|
host=settings.REDIS_ACTIVITY_HOST,
|
|
|
|
port=settings.REDIS_ACTIVITY_PORT,
|
2022-01-13 16:15:24 +00:00
|
|
|
db=settings.REDIS_ACTIVITY_DB_INDEX,
|
2021-03-28 18:38:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def erase_streams():
|
2021-04-26 16:15:42 +00:00
|
|
|
"""throw the whole redis away"""
|
2021-03-28 18:38:39 +00:00
|
|
|
r.flushall()
|
|
|
|
|
2021-03-28 18:51:02 +00:00
|
|
|
|
2021-03-28 18:38:39 +00:00
|
|
|
class Command(BaseCommand):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""delete activity streams for all users"""
|
2021-03-28 18:38:39 +00:00
|
|
|
|
|
|
|
help = "Delete all the user streams"
|
|
|
|
# pylint: disable=no-self-use,unused-argument
|
|
|
|
def handle(self, *args, **options):
|
2021-04-26 16:15:42 +00:00
|
|
|
"""flush all, baby"""
|
2021-03-28 18:38:39 +00:00
|
|
|
erase_streams()
|