From e73f3aa66dc0fb0f18e524fbd2c68778f9dbba7e Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Thu, 14 Mar 2013 19:26:22 -0700 Subject: [PATCH] Increasing feed fetches quite a bit. --- apps/rss_feeds/models.py | 8 ++++---- config/hosts | 3 +++ fabfile.py | 9 ++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/apps/rss_feeds/models.py b/apps/rss_feeds/models.py index 07ced16e7..bdc43d344 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 = 12 * 60 / max(.25, ((max(0, self.active_subscribers)**.2) + updates_per_day_delay = 3 * 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 = 12 * 60 / max(.167, max(0, self.active_subscribers)**3) + subscriber_bonus = 6 * 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,9 +1242,9 @@ 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(15, int(updates_per_day_delay + subscriber_bonus + slow_punishment)) + total = max(5, int(updates_per_day_delay + subscriber_bonus + slow_punishment)) - if self.active_premium_subscribers > 5: + if self.active_premium_subscribers > 3: total = min(total, 60) # 1 hour minimum for premiums if ((self.stories_last_month == 0 or self.average_stories_per_month == 0)): diff --git a/config/hosts b/config/hosts index 2edfa242f..48889655c 100644 --- a/config/hosts +++ b/config/hosts @@ -7,7 +7,10 @@ 198.211.110.230 app12 app12.newsblur.com +198.211.110.131 app11 app11.newsblur.com 198.211.109.197 app10 app10.newsblur.com +192.34.61.227 app13 app13.newsblur.com +198.211.109.155 app14 app14.newsblur.com 199.15.249.101 db01 db01.newsblur.com 199.15.252.50 db02 db02.newsblur.com diff --git a/fabfile.py b/fabfile.py index 7482919d4..9d6cb3b2a 100644 --- a/fabfile.py +++ b/fabfile.py @@ -38,6 +38,9 @@ env.roledefs ={ 'app03.newsblur.com', 'app04.newsblur.com', '198.211.110.230', + '198.211.110.131', + '192.34.61.227', + '198.211.109.155', ], 'dev': ['dev.newsblur.com'], 'web': ['app01.newsblur.com', @@ -94,6 +97,9 @@ env.roledefs ={ '198.211.109.224', '198.211.110.164', '198.211.110.230', + '198.211.110.131', + '192.34.61.227', + '198.211.109.155', ] } @@ -683,6 +689,7 @@ def maintenance_off(): # = Setup - DB = # ============== +@parallel def setup_db_firewall(): ports = [ 5432, # PostgreSQL @@ -875,7 +882,7 @@ def copy_task_settings(): # ========================= def setup_do(name): - INSTANCE_SIZE = "8GB" + INSTANCE_SIZE = "2GB" IMAGE_NAME = "Ubuntu 12.04 x64 Server" doapi = dop.client.Client(django_settings.DO_CLIENT_KEY, django_settings.DO_API_KEY) sizes = dict((s.name, s.id) for s in doapi.sizes())