mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Pushing out feed updates until able to handle the giant influx.
This commit is contained in:
parent
0d0baebc73
commit
85c85ab565
2 changed files with 8 additions and 9 deletions
|
@ -1220,7 +1220,7 @@ class Feed(models.Model):
|
|||
# 2 subscribers:
|
||||
# 1 update per day = 1 hours
|
||||
# 10 updates = 20 minutes
|
||||
updates_per_day_delay = 3 * 60 / max(.25, ((max(0, self.active_subscribers)**.2)
|
||||
updates_per_day_delay = 12 * 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 = 6 * 60 / max(.167, max(0, self.active_subscribers)**3)
|
||||
subscriber_bonus = 12 * 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,13 +1242,12 @@ 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(4, int(updates_per_day_delay + subscriber_bonus + slow_punishment))
|
||||
total = max(15, int(updates_per_day_delay + subscriber_bonus + slow_punishment))
|
||||
|
||||
if self.active_premium_subscribers > 0:
|
||||
if self.active_premium_subscribers > 5:
|
||||
total = min(total, 60) # 1 hour minimum for premiums
|
||||
|
||||
if (self.active_premium_subscribers <= 1 and
|
||||
(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)):
|
||||
total = total * random.randint(1, 12)
|
||||
|
||||
if self.is_push:
|
||||
|
@ -1256,7 +1255,7 @@ class Feed(models.Model):
|
|||
|
||||
# 1 month max
|
||||
if total > 60*24*30:
|
||||
total = 60*24*30
|
||||
total = 60*24*30
|
||||
|
||||
if verbose:
|
||||
print "[%s] %s (%s/%s/%s/%s), %s, %s: %s" % (self, updates_per_day_delay,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
; database name = connect string
|
||||
[databases]
|
||||
|
||||
newsblur = host=db01 port=5432 dbname=newsblur
|
||||
slave = host=db10 port=5432 dbname=newsblur
|
||||
newsblur = host=db11 port=5432 dbname=newsblur
|
||||
slave = host=db01 port=5432 dbname=newsblur
|
||||
|
||||
;; Configuation section
|
||||
[pgbouncer]
|
||||
|
|
Loading…
Add table
Reference in a new issue