Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-04-04 21:00:26 -07:00
commit a3d5d352a7
2 changed files with 6 additions and 4 deletions

View file

@ -39,7 +39,7 @@ class ActivityStream(ABC):
# add the status to the feed
pipeline.zadd(self.stream_id(user), value)
pipeline.zremrangebyrank(
self.stream_id(user), settings.MAX_STREAM_LENGTH, -1
self.stream_id(user), 0, -1 * settings.MAX_STREAM_LENGTH
)
# add to the unread status count
pipeline.incr(self.unread_id(user))
@ -61,7 +61,7 @@ class ActivityStream(ABC):
pipeline.zadd(self.stream_id(viewer), self.get_value(status))
if statuses:
pipeline.zremrangebyrank(
self.stream_id(user), settings.MAX_STREAM_LENGTH, -1
self.stream_id(user), 0, -1 * settings.MAX_STREAM_LENGTH
)
pipeline.execute()
@ -99,7 +99,9 @@ class ActivityStream(ABC):
# only trim the stream if statuses were added
if statuses.exists():
pipeline.zremrangebyrank(stream_id, settings.MAX_STREAM_LENGTH, -1)
pipeline.zremrangebyrank(
self.stream_id(user), 0, -1 * settings.MAX_STREAM_LENGTH
)
pipeline.execute()
def stream_users(self, status): # pylint: disable=no-self-use

View file

@ -99,7 +99,7 @@ REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost")
REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379)
REDIS_ACTIVITY_PASSWORD = env("REDIS_ACTIVITY_PASSWORD")
MAX_STREAM_LENGTH = int(env("MAX_STREAM_LENGTH", 200))
MAX_STREAM_LENGTH = 3 # int(env("MAX_STREAM_LENGTH", 200))
STREAMS = ["home", "local", "federated"]
# Database