mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 13:01:08 +00:00
Fixes trimming streams
This commit is contained in:
parent
a571bbb48a
commit
940e841502
2 changed files with 6 additions and 4 deletions
|
@ -36,7 +36,7 @@ class ActivityStream(ABC):
|
||||||
# add the status to the feed
|
# add the status to the feed
|
||||||
pipeline.zadd(self.stream_id(user), value)
|
pipeline.zadd(self.stream_id(user), value)
|
||||||
pipeline.zremrangebyrank(
|
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
|
# add to the unread status count
|
||||||
pipeline.incr(self.unread_id(user))
|
pipeline.incr(self.unread_id(user))
|
||||||
|
@ -58,7 +58,7 @@ class ActivityStream(ABC):
|
||||||
pipeline.zadd(self.stream_id(viewer), self.get_value(status))
|
pipeline.zadd(self.stream_id(viewer), self.get_value(status))
|
||||||
if statuses:
|
if statuses:
|
||||||
pipeline.zremrangebyrank(
|
pipeline.zremrangebyrank(
|
||||||
self.stream_id(user), settings.MAX_STREAM_LENGTH, -1
|
self.stream_id(user), 0, -1 * settings.MAX_STREAM_LENGTH
|
||||||
)
|
)
|
||||||
pipeline.execute()
|
pipeline.execute()
|
||||||
|
|
||||||
|
@ -96,7 +96,9 @@ class ActivityStream(ABC):
|
||||||
|
|
||||||
# only trim the stream if statuses were added
|
# only trim the stream if statuses were added
|
||||||
if statuses.exists():
|
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()
|
pipeline.execute()
|
||||||
|
|
||||||
def stream_users(self, status): # pylint: disable=no-self-use
|
def stream_users(self, status): # pylint: disable=no-self-use
|
||||||
|
|
|
@ -98,7 +98,7 @@ WSGI_APPLICATION = "bookwyrm.wsgi.application"
|
||||||
REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost")
|
REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost")
|
||||||
REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379)
|
REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379)
|
||||||
|
|
||||||
MAX_STREAM_LENGTH = int(env("MAX_STREAM_LENGTH", 200))
|
MAX_STREAM_LENGTH = 3 # int(env("MAX_STREAM_LENGTH", 200))
|
||||||
STREAMS = ["home", "local", "federated"]
|
STREAMS = ["home", "local", "federated"]
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
|
|
Loading…
Reference in a new issue