mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Handling decayed feeds with no more active subscribers. They don't get returned to the scheduled_updates queue until there are enough active users.
This commit is contained in:
parent
e11e8398d1
commit
842afe7068
3 changed files with 7 additions and 3 deletions
|
@ -233,9 +233,11 @@ def load_feeds(request):
|
|||
if update_counts:
|
||||
sub.calculate_feed_scores(silent=True)
|
||||
feeds[pk] = sub.canonical(include_favicon=include_favicons)
|
||||
|
||||
if not sub.active: continue
|
||||
if not sub.feed.active and not sub.feed.has_feed_exception and not sub.feed.has_page_exception:
|
||||
scheduled_feeds.append(sub.feed.pk)
|
||||
elif sub.active and sub.feed.active_subscribers <= 0:
|
||||
elif sub.feed.active_subscribers <= 0:
|
||||
scheduled_feeds.append(sub.feed.pk)
|
||||
elif sub.feed.next_scheduled_update < day_ago:
|
||||
scheduled_feeds.append(sub.feed.pk)
|
||||
|
|
|
@ -11,7 +11,9 @@ class Migration(DataMigration):
|
|||
start = 0
|
||||
for f in xrange(start, Feed.objects.latest('pk').pk, 1000):
|
||||
print " ---> %s" % f
|
||||
feed = Feed.objects.filter(pk__in=range(f, f+1000), active=True)\
|
||||
feed = Feed.objects.filter(pk__in=range(f, f+1000),
|
||||
active=True,
|
||||
active_subscribers__gte=1)\
|
||||
.values_list('pk', 'next_scheduled_update')
|
||||
p = r.pipeline()
|
||||
for pk, s, m in feed:
|
||||
|
|
|
@ -1292,7 +1292,7 @@ class Feed(models.Model):
|
|||
|
||||
|
||||
self.min_to_decay = total
|
||||
if not skip_scheduling:
|
||||
if not skip_scheduling and self.active_subscribers >= 1:
|
||||
self.next_scheduled_update = next_scheduled_update
|
||||
r.zadd('scheduled_updates', self.pk, self.next_scheduled_update.strftime('%s'))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue