From acff62b8f66446f2864c84e731f67461638e792c Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Mon, 5 Aug 2013 10:23:22 -0700 Subject: [PATCH] Moving feed trim to higher counts unless the feed doesn't publish very often. --- apps/rss_feeds/models.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/apps/rss_feeds/models.py b/apps/rss_feeds/models.py index 368b65c2c..d75533a91 100644 --- a/apps/rss_feeds/models.py +++ b/apps/rss_feeds/models.py @@ -1087,19 +1087,24 @@ class Feed(models.Model): cutoff = 500 if self.active_subscribers <= 0: cutoff = 25 - elif self.num_subscribers <= 10 or self.active_premium_subscribers <= 1: + elif self.active_premium_subscribers < 1: cutoff = 100 - elif self.num_subscribers <= 30 or self.active_premium_subscribers <= 3: + elif self.active_premium_subscribers <= 2: cutoff = 200 - elif self.num_subscribers <= 50 or self.active_premium_subscribers <= 5: + elif self.active_premium_subscribers <= 5: cutoff = 300 - elif self.num_subscribers <= 100 or self.active_premium_subscribers <= 10: + elif self.active_premium_subscribers <= 10: cutoff = 350 - elif self.num_subscribers <= 150 or self.active_premium_subscribers <= 15: + elif self.active_premium_subscribers <= 15: cutoff = 400 - elif self.num_subscribers <= 200 or self.active_premium_subscribers <= 20: + elif self.active_premium_subscribers <= 20: cutoff = 450 - + + if self.active_subscribers and self.average_stories_per_month < 5 and self.stories_last_month < 5: + cutoff /= 2 + if self.active_premium_subscribers <= 1 and self.average_stories_per_month <= 1 and self.stories_last_month <= 1: + cutoff /= 2 + return cutoff def trim_feed(self, verbose=False, cutoff=None): @@ -1642,7 +1647,7 @@ class MStory(mongo.Document): ).order_by('-story_date') if stories.count() > cutoff: - logging.debug(' ---> [%-30s] ~FBFound %s stories. Trimming to ~SB%s~SN...' % + logging.debug(' ---> [%-30s] ~FMFound %s stories. Trimming to ~SB%s~SN...' % (unicode(feed)[:30], stories.count(), cutoff)) try: story_trim_date = stories[cutoff].story_date