Forcing pipeline to flush every 1000 stories.

This commit is contained in:
Samuel Clay 2013-04-08 17:17:51 -07:00
parent a6837724e3
commit 6fe7487202

View file

@ -706,12 +706,17 @@ class MUserStory(mongo.Document):
total = read_stories.count()
print " ---> Syncing %s stories (%s)" % (total, user_id or feed_id)
pipeline = r.pipeline()
pipeline = None
for i, read_story in enumerate(read_stories):
if not pipeline:
pipeline = r.pipeline()
if (i+1) % 1000 == 0:
print " ---> %s/%s" % (i+1, total)
pipeline.execute()
pipeline = r.pipeline()
read_story.sync_redis(r, pipeline=pipeline)
pipeline.execute()
if pipeline:
pipeline.execute()
class UserSubscriptionFolders(models.Model):
"""