mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Adding read story trimmer.
This commit is contained in:
parent
f632ab53f9
commit
69492f9a52
1 changed files with 13 additions and 0 deletions
|
@ -385,7 +385,20 @@ class UserSubscription(models.Model):
|
|||
feeds[feed_id]['exception_code'] = sub.feed.exception_code
|
||||
|
||||
return feeds
|
||||
|
||||
def sync_redis(self, r=None):
|
||||
if not r:
|
||||
r = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_POOL)
|
||||
|
||||
read_stories_key = "RS:%s:%s" % (self.user_id, self.feed_id)
|
||||
stale_story_hashes = r.sdiff(read_stories_key, "F:%s" % self.feed_id)
|
||||
if not stale_story_hashes:
|
||||
return
|
||||
|
||||
logging.user(self.user, "~FBTrimming %s read stories..." % (len(stale_story_hashes)))
|
||||
r.srem(read_stories_key, *stale_story_hashes)
|
||||
r.srem("RS:%s" % self.feed_id, *stale_story_hashes)
|
||||
|
||||
def mark_feed_read(self):
|
||||
if (self.unread_count_negative == 0
|
||||
and self.unread_count_neutral == 0
|
||||
|
|
Loading…
Add table
Reference in a new issue