Increasing feed fetches quite a bit.

This commit is contained in:
Samuel Clay 2013-03-14 19:26:22 -07:00
parent 8f5814bf1f
commit e73f3aa66d
3 changed files with 15 additions and 5 deletions

View file

@ -1220,7 +1220,7 @@ class Feed(models.Model):
# 2 subscribers: # 2 subscribers:
# 1 update per day = 1 hours # 1 update per day = 1 hours
# 10 updates = 20 minutes # 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))) * (updates_per_month**0.35)))
if self.premium_subscribers > 0: if self.premium_subscribers > 0:
updates_per_day_delay /= min(self.active_subscribers+self.premium_subscribers, 5) 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. # .5 hours for 2 subscribers.
# .25 hours for 3 subscribers. # .25 hours for 3 subscribers.
# 1 min for 10 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: if self.premium_subscribers > 0:
subscriber_bonus /= min(self.active_subscribers+self.premium_subscribers, 5) 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 slow_punishment = 2 * self.last_load_time
elif self.last_load_time >= 200: elif self.last_load_time >= 200:
slow_punishment = 6 * self.last_load_time 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 total = min(total, 60) # 1 hour minimum for premiums
if ((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)):

View file

@ -7,7 +7,10 @@
198.211.110.230 app12 app12.newsblur.com 198.211.110.230 app12 app12.newsblur.com
198.211.110.131 app11 app11.newsblur.com
198.211.109.197 app10 app10.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.249.101 db01 db01.newsblur.com
199.15.252.50 db02 db02.newsblur.com 199.15.252.50 db02 db02.newsblur.com

9
fabfile.py vendored
View file

@ -38,6 +38,9 @@ env.roledefs ={
'app03.newsblur.com', 'app03.newsblur.com',
'app04.newsblur.com', 'app04.newsblur.com',
'198.211.110.230', '198.211.110.230',
'198.211.110.131',
'192.34.61.227',
'198.211.109.155',
], ],
'dev': ['dev.newsblur.com'], 'dev': ['dev.newsblur.com'],
'web': ['app01.newsblur.com', 'web': ['app01.newsblur.com',
@ -94,6 +97,9 @@ env.roledefs ={
'198.211.109.224', '198.211.109.224',
'198.211.110.164', '198.211.110.164',
'198.211.110.230', '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 = # = Setup - DB =
# ============== # ==============
@parallel
def setup_db_firewall(): def setup_db_firewall():
ports = [ ports = [
5432, # PostgreSQL 5432, # PostgreSQL
@ -875,7 +882,7 @@ def copy_task_settings():
# ========================= # =========================
def setup_do(name): def setup_do(name):
INSTANCE_SIZE = "8GB" INSTANCE_SIZE = "2GB"
IMAGE_NAME = "Ubuntu 12.04 x64 Server" IMAGE_NAME = "Ubuntu 12.04 x64 Server"
doapi = dop.client.Client(django_settings.DO_CLIENT_KEY, django_settings.DO_API_KEY) 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()) sizes = dict((s.name, s.id) for s in doapi.sizes())