Adding pipeline for redis sync on usersub.

This commit is contained in:
Samuel Clay 2013-04-08 18:22:04 -07:00
parent ede93d2117
commit 38b7ca8f12

View file

@ -101,8 +101,13 @@ class UserSubscription(models.Model):
self.feed.sync_redis()
userstories = MUserStory.objects.filter(feed_id=self.feed_id, user_id=self.user_id)
total = userstories.count()
logging.debug(" ---> ~SN~FMSyncing ~SB%s~SN stories (%s)" % (total, self))
pipeline = r.pipeline()
for userstory in userstories:
userstory.sync_redis(r=r)
userstory.sync_redis(pipeline=pipeline)
pipeline.execute()
def get_stories(self, offset=0, limit=6, order='newest', read_filter='all', withscores=False):
r = redis.Redis(connection_pool=settings.REDIS_STORY_POOL)