mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Merge branch 'master' into ruserstory
* master: Using story cache when calculating unreads, for those who need unread counts updating.
This commit is contained in:
commit
8da72b2c22
2 changed files with 5 additions and 0 deletions
|
@ -380,6 +380,9 @@ class UserSubscription(models.Model):
|
|||
else:
|
||||
self.mark_read_date = date_delta
|
||||
|
||||
if not stories:
|
||||
stories = cache.get('S:%s' % self.feed_id)
|
||||
|
||||
if not stories:
|
||||
stories_db = MStory.objects(story_feed_id=self.feed_id,
|
||||
story_date__gte=date_delta)
|
||||
|
|
|
@ -9,6 +9,7 @@ import random
|
|||
import pymongo
|
||||
from django.conf import settings
|
||||
from django.db import IntegrityError
|
||||
from django.core.cache import cache
|
||||
from apps.reader.models import UserSubscription, MUserStory
|
||||
from apps.rss_feeds.models import Feed, MStory
|
||||
from apps.rss_feeds.page_importer import PageImporter
|
||||
|
@ -542,6 +543,7 @@ class Dispatcher:
|
|||
story_date__gte=UNREAD_CUTOFF)\
|
||||
.read_preference(pymongo.ReadPreference.PRIMARY)
|
||||
stories = Feed.format_stories(stories, feed.pk)
|
||||
cache.set("S:%s" % feed.pk, stories, 60)
|
||||
logging.debug(u' ---> [%-30s] ~FYComputing scores: ~SB%s stories~SN with ~SB%s subscribers ~SN(%s/%s/%s)' % (
|
||||
feed.title[:30], len(stories), user_subs.count(),
|
||||
feed.num_subscribers, feed.active_subscribers, feed.premium_subscribers))
|
||||
|
|
Loading…
Add table
Reference in a new issue