mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Checking if a feed has any notifications on it, set a max of 30 min fetch (yes this is a pretty good way of getting your feeds to fetch faster, but youll have to deal with the notifications).
This commit is contained in:
parent
d2f1a417c9
commit
33183967b3
1 changed files with 7 additions and 0 deletions
|
@ -2099,12 +2099,15 @@ class Feed(models.Model):
|
|||
if self.min_to_decay and not force and not premium_speed:
|
||||
return self.min_to_decay
|
||||
|
||||
from apps.notifications.models import MUserFeedNotification
|
||||
|
||||
if premium_speed:
|
||||
self.active_premium_subscribers += 1
|
||||
|
||||
spd = self.stories_last_month / 30.0
|
||||
subs = (self.active_premium_subscribers +
|
||||
((self.active_subscribers - self.active_premium_subscribers) / 10.0))
|
||||
notification_count = MUserFeedNotification.objects.filter(feed_id=self.pk).count()
|
||||
# Calculate sub counts:
|
||||
# SELECT COUNT(*) FROM feeds WHERE active_premium_subscribers > 10 AND stories_last_month >= 30;
|
||||
# SELECT COUNT(*) FROM feeds WHERE active_premium_subscribers > 1 AND active_premium_subscribers < 10 AND stories_last_month >= 30;
|
||||
|
@ -2163,6 +2166,10 @@ class Feed(models.Model):
|
|||
if len(fetch_history['push_history']):
|
||||
total = total * 12
|
||||
|
||||
# Any notifications means a 30 min minumum
|
||||
if notification_count > 0:
|
||||
total = min(total, 30)
|
||||
|
||||
# 4 hour max for premiums, 48 hour max for free
|
||||
if subs >= 1:
|
||||
total = min(total, 60*4*1)
|
||||
|
|
Loading…
Add table
Reference in a new issue