mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Merge branch 'master' into search
* master: Debugging tasking of feeds. Only fetching feeds immediately if necessary. Upping django_ext version.
This commit is contained in:
commit
99ab4520b7
4 changed files with 21 additions and 10 deletions
|
@ -259,7 +259,7 @@ def load_feeds(request):
|
|||
if len(scheduled_feeds) > 0 and request.user.is_authenticated():
|
||||
logging.user(request, "~SN~FMTasking the scheduling immediate fetch of ~SB%s~SN feeds..." %
|
||||
len(scheduled_feeds))
|
||||
ScheduleImmediateFetches.apply_async(kwargs=dict(feed_ids=scheduled_feeds))
|
||||
ScheduleImmediateFetches.apply_async(kwargs=dict(feed_ids=scheduled_feeds, user_id=user.pk))
|
||||
|
||||
starred_counts, starred_count = MStarredStoryCounts.user_counts(user.pk, include_total=True)
|
||||
if not starred_count and len(starred_counts):
|
||||
|
@ -344,7 +344,7 @@ def load_feeds_flat(request):
|
|||
if len(scheduled_feeds) > 0 and request.user.is_authenticated():
|
||||
logging.user(request, "~SN~FMTasking the scheduling immediate fetch of ~SB%s~SN feeds..." %
|
||||
len(scheduled_feeds))
|
||||
ScheduleImmediateFetches.apply_async(kwargs=dict(feed_ids=scheduled_feeds))
|
||||
ScheduleImmediateFetches.apply_async(kwargs=dict(feed_ids=scheduled_feeds, user_id=user.pk))
|
||||
|
||||
flat_folders = []
|
||||
if folders:
|
||||
|
|
|
@ -322,18 +322,29 @@ class Feed(models.Model):
|
|||
self.feed_address = "http://www.google.com/alerts/feeds/%s/%s" % (user_id, alert_id)
|
||||
|
||||
@classmethod
|
||||
def schedule_feed_fetches_immediately(cls, feed_ids):
|
||||
def schedule_feed_fetches_immediately(cls, feed_ids, user_id=None):
|
||||
if settings.DEBUG:
|
||||
logging.info(" ---> ~SN~FMSkipping the scheduling immediate fetch of ~SB%s~SN feeds (in DEBUG)..." %
|
||||
len(feed_ids))
|
||||
return
|
||||
logging.info(" ---> ~SN~FMScheduling immediate fetch of ~SB%s~SN feeds..." %
|
||||
len(feed_ids))
|
||||
|
||||
if user_id:
|
||||
user = User.objects.get(pk=user_id)
|
||||
logging.user(user, "~SN~FMScheduling immediate fetch of ~SB%s~SN feeds..." %
|
||||
len(feed_ids))
|
||||
else:
|
||||
logging.debug(" ---> ~SN~FMScheduling immediate fetch of ~SB%s~SN feeds..." %
|
||||
len(feed_ids))
|
||||
|
||||
if len(feed_ids) > 100:
|
||||
logging.debug(" ---> ~SN~FMFeeds scheduled: %s" % feed_ids)
|
||||
day_ago = datetime.datetime.now() - datetime.timedelta(days=1)
|
||||
feeds = Feed.objects.filter(pk__in=feed_ids)
|
||||
for feed in feeds:
|
||||
feed.count_subscribers()
|
||||
feed.schedule_feed_fetch_immediately(verbose=False)
|
||||
if feed.active_subscribers <= 0:
|
||||
feed.count_subscribers()
|
||||
if not feed.active or feed.next_scheduled_update < day_ago:
|
||||
feed.schedule_feed_fetch_immediately(verbose=False)
|
||||
|
||||
@property
|
||||
def favicon_fetching(self):
|
||||
|
|
|
@ -197,13 +197,13 @@ class BackupMongo(Task):
|
|||
|
||||
class ScheduleImmediateFetches(Task):
|
||||
|
||||
def run(self, feed_ids, **kwargs):
|
||||
def run(self, feed_ids, user_id, **kwargs):
|
||||
from apps.rss_feeds.models import Feed
|
||||
|
||||
if not isinstance(feed_ids, list):
|
||||
feed_ids = [feed_ids]
|
||||
|
||||
Feed.schedule_feed_fetches_immediately(feed_ids)
|
||||
Feed.schedule_feed_fetches_immediately(feed_ids, user_id)
|
||||
|
||||
|
||||
class SchedulePremiumSetup(Task):
|
||||
|
|
|
@ -6,7 +6,7 @@ cssutils==0.9.10b1
|
|||
django-celery-with-redis==3.0
|
||||
django-celery==3.0.11
|
||||
django-compress==1.0.1
|
||||
django-extensions==1.1.1
|
||||
django-extensions==1.3.3
|
||||
django-mailgun==0.2.1
|
||||
django-redis-sessions==0.3.1
|
||||
django-redis-cache==0.9.7
|
||||
|
|
Loading…
Add table
Reference in a new issue