From 85c85ab565b373e986575356bec5d6f209d80d24 Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 14 Mar 2013 15:52:34 -0700 Subject: [PATCH] Pushing out feed updates until able to handle the giant influx. --- apps/rss_feeds/models.py | 13 ++++++------- config/pgbouncer.conf | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/rss_feeds/models.py b/apps/rss_feeds/models.py index 777d544ab..07ced16e7 100644 --- a/apps/rss_feeds/models.py +++ b/apps/rss_feeds/models.py @@ -1220,7 +1220,7 @@ class Feed(models.Model): # 2 subscribers: # 1 update per day = 1 hours # 10 updates = 20 minutes - updates_per_day_delay = 3 * 60 / max(.25, ((max(0, self.active_subscribers)**.2) + updates_per_day_delay = 12 * 60 / max(.25, ((max(0, self.active_subscribers)**.2) * (updates_per_month**0.35))) if self.premium_subscribers > 0: updates_per_day_delay /= min(self.active_subscribers+self.premium_subscribers, 5) @@ -1230,7 +1230,7 @@ class Feed(models.Model): # .5 hours for 2 subscribers. # .25 hours for 3 subscribers. # 1 min for 10 subscribers. - subscriber_bonus = 6 * 60 / max(.167, max(0, self.active_subscribers)**3) + subscriber_bonus = 12 * 60 / max(.167, max(0, self.active_subscribers)**3) if self.premium_subscribers > 0: subscriber_bonus /= min(self.active_subscribers+self.premium_subscribers, 5) @@ -1242,13 +1242,12 @@ class Feed(models.Model): slow_punishment = 2 * self.last_load_time elif self.last_load_time >= 200: slow_punishment = 6 * self.last_load_time - total = max(4, int(updates_per_day_delay + subscriber_bonus + slow_punishment)) + total = max(15, int(updates_per_day_delay + subscriber_bonus + slow_punishment)) - if self.active_premium_subscribers > 0: + if self.active_premium_subscribers > 5: total = min(total, 60) # 1 hour minimum for premiums - if (self.active_premium_subscribers <= 1 and - (self.stories_last_month == 0 or self.average_stories_per_month == 0)): + if ((self.stories_last_month == 0 or self.average_stories_per_month == 0)): total = total * random.randint(1, 12) if self.is_push: @@ -1256,7 +1255,7 @@ class Feed(models.Model): # 1 month max if total > 60*24*30: - total = 60*24*30 + total = 60*24*30 if verbose: print "[%s] %s (%s/%s/%s/%s), %s, %s: %s" % (self, updates_per_day_delay, diff --git a/config/pgbouncer.conf b/config/pgbouncer.conf index a2eb8c0d3..b0f86caf3 100644 --- a/config/pgbouncer.conf +++ b/config/pgbouncer.conf @@ -1,8 +1,8 @@ ; database name = connect string [databases] -newsblur = host=db01 port=5432 dbname=newsblur -slave = host=db10 port=5432 dbname=newsblur +newsblur = host=db11 port=5432 dbname=newsblur +slave = host=db01 port=5432 dbname=newsblur ;; Configuation section [pgbouncer]