mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-05 16:49:45 +00:00
Forcing pipeline to flush every 1000 stories.
This commit is contained in:
parent
a6837724e3
commit
6fe7487202
1 changed files with 7 additions and 2 deletions
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue