mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Better logging for unread counts to see where counts are going moving.
This commit is contained in:
parent
1204efeecd
commit
cceda612f6
2 changed files with 26 additions and 19 deletions
|
@ -353,7 +353,10 @@ class UserSubscription(models.Model):
|
|||
if self.user.profile.last_seen_on < UNREAD_CUTOFF and not force:
|
||||
# if not silent:
|
||||
# logging.info(' ---> [%s] SKIPPING Computing scores: %s (1 week+)' % (self.user, self.feed))
|
||||
return
|
||||
return self
|
||||
ong = self.unread_count_negative
|
||||
ont = self.unread_count_neutral
|
||||
ops = self.unread_count_positive
|
||||
|
||||
# if not self.feed.fetched_once:
|
||||
# if not silent:
|
||||
|
@ -427,8 +430,7 @@ class UserSubscription(models.Model):
|
|||
feed_scores['neutral'] += 1
|
||||
|
||||
|
||||
# if not silent:
|
||||
# logging.info(' ---> [%s] End classifiers: %s' % (self.user, datetime.datetime.now() - now))
|
||||
logging.user(self.user, '~FBUnread count (~SB%s~SN): ~SN(~FC%s~FB/~FC%s~FB/~FC%s~FB) ~SBto~SN (~FC%s~FB/~FC%s~FB/~FC%s~FB)' % (self.feed_id, ong, ont, ops, feed_scores['negative'], feed_scores['neutral'], feed_scores['positive']))
|
||||
|
||||
self.unread_count_positive = feed_scores['positive']
|
||||
self.unread_count_neutral = feed_scores['neutral']
|
||||
|
|
|
@ -1071,25 +1071,30 @@ class Feed(models.Model):
|
|||
print " DRYRUN: %s cutoff - %s" % (cutoff, feed)
|
||||
else:
|
||||
MStory.trim_feed(feed=feed, cutoff=cutoff, verbose=verbose)
|
||||
|
||||
@property
|
||||
def story_cutoff(self):
|
||||
cutoff = 500
|
||||
if self.active_subscribers <= 0:
|
||||
cutoff = 25
|
||||
elif self.num_subscribers <= 10 or self.active_premium_subscribers <= 1:
|
||||
cutoff = 100
|
||||
elif self.num_subscribers <= 30 or self.active_premium_subscribers <= 3:
|
||||
cutoff = 200
|
||||
elif self.num_subscribers <= 50 or self.active_premium_subscribers <= 5:
|
||||
cutoff = 300
|
||||
elif self.num_subscribers <= 100 or self.active_premium_subscribers <= 10:
|
||||
cutoff = 350
|
||||
elif self.num_subscribers <= 150 or self.active_premium_subscribers <= 15:
|
||||
cutoff = 400
|
||||
elif self.num_subscribers <= 200 or self.active_premium_subscribers <= 20:
|
||||
cutoff = 450
|
||||
|
||||
return cutoff
|
||||
|
||||
def trim_feed(self, verbose=False, cutoff=None):
|
||||
if not cutoff:
|
||||
cutoff = 500
|
||||
if self.active_subscribers <= 0:
|
||||
cutoff = 25
|
||||
elif self.num_subscribers <= 10 or self.active_premium_subscribers <= 1:
|
||||
cutoff = 100
|
||||
elif self.num_subscribers <= 30 or self.active_premium_subscribers <= 3:
|
||||
cutoff = 200
|
||||
elif self.num_subscribers <= 50 or self.active_premium_subscribers <= 5:
|
||||
cutoff = 300
|
||||
elif self.num_subscribers <= 100 or self.active_premium_subscribers <= 10:
|
||||
cutoff = 350
|
||||
elif self.num_subscribers <= 150 or self.active_premium_subscribers <= 15:
|
||||
cutoff = 400
|
||||
elif self.num_subscribers <= 200 or self.active_premium_subscribers <= 20:
|
||||
cutoff = 450
|
||||
|
||||
cutoff = self.story_cutoff
|
||||
MStory.trim_feed(feed=self, cutoff=cutoff, verbose=verbose)
|
||||
|
||||
# @staticmethod
|
||||
|
|
Loading…
Add table
Reference in a new issue