mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing emergency bug around trimming feeds where the cursor is changing. Dammit mongo.
This commit is contained in:
parent
fd2b778363
commit
999b12e00b
1 changed files with 5 additions and 1 deletions
|
@ -772,7 +772,11 @@ class Feed(models.Model):
|
|||
if stories.count() > trim_cutoff:
|
||||
if verbose:
|
||||
print 'Found %s stories in %s. Trimming to %s...' % (stories.count(), self, trim_cutoff)
|
||||
story_trim_date = stories[trim_cutoff].story_date
|
||||
try:
|
||||
story_trim_date = stories[trim_cutoff].story_date
|
||||
except IndexError, e:
|
||||
logging.debug(' ***> [%-30s] Error trimming feed: %s' % (self, e))
|
||||
return
|
||||
extra_stories = MStory.objects(story_feed_id=self.pk, story_date__lte=story_trim_date)
|
||||
extra_stories.delete()
|
||||
# print "Deleted stories, %s left." % MStory.objects(story_feed_id=self.pk).count()
|
||||
|
|
Loading…
Add table
Reference in a new issue