Unfortunately I need to slow down feed fetches by a bit until I can handle the load again.

This commit is contained in:
Samuel Clay 2011-11-01 07:32:15 -07:00
parent e8272ddcc0
commit 4e466335bb

View file

@ -894,7 +894,7 @@ class Feed(models.Model):
# 2 subscribers:
# 1 update per day = 1 hours
# 10 updates = 20 minutes
updates_per_day_delay = 2 * 60 / max(.25, ((max(0, self.active_subscribers)**.15)
updates_per_day_delay = 6 * 60 / max(.25, ((max(0, self.active_subscribers)**.15)
* (updates_per_month**1.5)))
if self.premium_subscribers > 0:
updates_per_day_delay /= min(self.active_subscribers+self.premium_subscribers, 5)
@ -920,7 +920,7 @@ class Feed(models.Model):
# print "[%s] %s (%s-%s), %s, %s: %s" % (self, updates_per_day_delay, updates_per_day, self.num_subscribers, subscriber_bonus, slow_punishment, total)
random_factor = random.randint(0, total) / 4
return total, random_factor
return total, random_factor*2
def set_next_scheduled_update(self):
total, random_factor = self.get_next_scheduled_update(force=True)