More tweaking to feed refresh rate: Higher volume = more fetches

This commit is contained in:
Samuel Clay 2010-06-28 11:37:54 -04:00
parent 80bdb79bd9
commit 7212778d7c

View file

@ -320,15 +320,18 @@ class Feed(models.Model):
# Use stories per month to calculate next feed update # Use stories per month to calculate next feed update
updates_per_day = max(30, self.stories_per_month) / 30.0 updates_per_day = max(30, self.stories_per_month) / 30.0
# 1 update per day = 12 hours # 1 update per day = 12 hours
# > 1 update per day = 30 minutes # > 1 update per day:
minutes_to_next_update = 30 # 2 updates = 1.5 hours
# 4 updates = 45 minutes
# 10 updates = 18 minutes
minutes_to_next_update = 12 * 60 / (updates_per_day * 4)
if updates_per_day <= 1: if updates_per_day <= 1:
minutes_to_next_update = 60 * 12 minutes_to_next_update = 60 * 12
random_factor = random.randint(0,int(minutes_to_next_update/4)) random_factor = random.randint(0,int(minutes_to_next_update/6))
slow_punishment = 0
# 6 hours / subscribers. Lots of subscribers = lots of updates # 6 hours / subscribers. Lots of subscribers = lots of updates
subscriber_bonus = 6 * 60 / max(1, self.num_subscribers) subscriber_bonus = 6 * 60 / max(1, self.num_subscribers)
slow_punishment = 0
if 30 <= self.last_load_time < 60: if 30 <= self.last_load_time < 60:
slow_punishment = self.last_load_time slow_punishment = self.last_load_time
elif 60 <= self.last_load_time < 100: elif 60 <= self.last_load_time < 100: