mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Making feeds update WAY faster. Will I regret this? Most likely. But the weekend's the best time to find out.
This commit is contained in:
parent
338cc83326
commit
6aede04f10
1 changed files with 18 additions and 17 deletions
|
@ -696,31 +696,32 @@ class Feed(models.Model):
|
|||
return self.min_to_decay, random_factor
|
||||
|
||||
# Use stories per month to calculate next feed update
|
||||
updates_per_day = self.stories_last_month / 30.0
|
||||
updates_per_month = self.stories_last_month
|
||||
# if updates_per_day < 1 and self.num_subscribers > 2:
|
||||
# updates_per_day = 1
|
||||
# 0 updates per day = 24 hours
|
||||
# 1 subscriber:
|
||||
# 1 update per day = 6 hours
|
||||
# 2 updates = 3.5 hours
|
||||
# 4 updates = 2 hours
|
||||
# 10 updates = 1 hour
|
||||
# 0 updates per month = 4 hours
|
||||
# 1 update = 2 hours
|
||||
# 2 updates = 1.5 hours
|
||||
# 4 updates = 1 hours
|
||||
# 10 updates = .5 hour
|
||||
# 2 subscribers:
|
||||
# 1 update per day = 4.5 hours
|
||||
# 10 updates = 55 minutes
|
||||
updates_per_day_delay = 3 * 60 / max(.25, ((max(0, self.active_subscribers)**.20)
|
||||
* (updates_per_day**1.5)))
|
||||
# 1 update per day = 1 hours
|
||||
# 10 updates = 20 minutes
|
||||
updates_per_day_delay = 2 * 60 / max(.25, ((max(0, self.active_subscribers)**.80)
|
||||
* (updates_per_month**.5)))
|
||||
if self.premium_subscribers > 0:
|
||||
updates_per_day_delay /= 6
|
||||
updates_per_day_delay /= 5
|
||||
# Lots of subscribers = lots of updates
|
||||
# 144 hours for 0 subscribers.
|
||||
# 24 hours for 1 subscriber.
|
||||
# 7 hours for 2 subscribers.
|
||||
# 3 hours for 3 subscribers.
|
||||
# 25 min for 10 subscribers.
|
||||
# 24 hours for 0 subscribers.
|
||||
# 4 hours for 1 subscriber.
|
||||
# .5 hours for 2 subscribers.
|
||||
# .25 hours for 3 subscribers.
|
||||
# 1 min for 10 subscribers.
|
||||
subscriber_bonus = 4 * 60 / max(.167, max(0, self.active_subscribers)**3)
|
||||
if self.premium_subscribers > 0:
|
||||
subscriber_bonus /= 6
|
||||
subscriber_bonus /= 5
|
||||
|
||||
slow_punishment = 0
|
||||
if self.num_subscribers <= 1:
|
||||
|
@ -730,7 +731,7 @@ 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(6, int(updates_per_day_delay + subscriber_bonus + slow_punishment))
|
||||
total = max(4, int(updates_per_day_delay + subscriber_bonus + slow_punishment))
|
||||
# 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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue