Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaning up task feeds logging.

  • Loading branch information...
commit f94939b83e7e0044ae6f1282ac41fe263903d951 1 parent 50e3fc5
@samuelclay authored
View
16 apps/rss_feeds/models.py
@@ -278,17 +278,18 @@ def by_url(address):
return feed
@classmethod
- def task_feeds(cls, feeds, queue_size=12):
+ def task_feeds(cls, feeds, queue_size=12, verbose=True):
if isinstance(feeds, Feed):
- logging.debug(" ---> Tasking feed: %s" % feeds)
+ if verbose:
+ logging.debug(" ---> Tasking feed: %s" % feeds)
feeds = [feeds]
- else:
+ elif verbose:
logging.debug(" ---> Tasking %s feeds..." % len(feeds))
feed_queue = []
for f in feeds:
f.queued_date = datetime.datetime.utcnow()
- f.set_next_scheduled_update()
+ f.set_next_scheduled_update(verbose=False)
for feed_queue in (feeds[pos:pos + queue_size] for pos in xrange(0, len(feeds), queue_size)):
feed_ids = [feed.pk for feed in feed_queue]
@@ -1191,12 +1192,15 @@ def get_next_scheduled_update(self, force=False, verbose=True):
return total, random_factor*2
- def set_next_scheduled_update(self):
+ def set_next_scheduled_update(self, verbose=True):
total, random_factor = self.get_next_scheduled_update(force=True, verbose=False)
if self.errors_since_good:
total = total * self.errors_since_good
- logging.debug(' ---> [%-30s] ~FBScheduling feed fetch geometrically: ~SB%s errors. Time: %s min' % (unicode(self)[:30], self.errors_since_good, total))
+ if verbose:
+ logging.debug(' ---> [%-30s] ~FBScheduling feed fetch geometrically: '
+ '~SB%s errors. Time: %s min' % (
+ unicode(self)[:30], self.errors_since_good, total))
next_scheduled_update = datetime.datetime.utcnow() + datetime.timedelta(
minutes = total + random_factor)
View
16 apps/rss_feeds/tasks.py
@@ -22,7 +22,8 @@ def run(self, **kwargs):
).exclude(
active_subscribers=0
).order_by('?')
- Feed.task_feeds(feeds)
+ Feed.task_feeds(feeds, verbose=False)
+ active_count = feeds.count()
# Mistakenly inactive feeds
day = now - datetime.timedelta(days=1)
@@ -32,7 +33,8 @@ def run(self, **kwargs):
min_to_decay__lte=60*24,
active_subscribers__gte=1
).order_by('?')[:20]
- if feeds: Feed.task_feeds(feeds)
+ if feeds: Feed.task_feeds(feeds, verbose=False)
+ inactive_count = feeds.count()
week = now - datetime.timedelta(days=7)
feeds = Feed.objects.filter(
@@ -40,8 +42,14 @@ def run(self, **kwargs):
queued_date__lte=day,
active_subscribers__gte=1
).order_by('?')[:20]
- if feeds: Feed.task_feeds(feeds)
-
+ if feeds: Feed.task_feeds(feeds, verbose=False)
+ old_count = feeds.count()
+
+ logging.debug(" ---> ~FBTasking ~SB~FC%s~SN/~FC%s~SN/~FC%s~SN~FB feeds..." % (
+ active_count,
+ inactive_count,
+ old_count,
+ ))
class UpdateFeeds(Task):
name = 'update-feeds'
View
6 media/ios/Classes/TrainerViewController.m
@@ -33,7 +33,11 @@ - (void)viewDidLoad
navBar.tintColor = UIColorFromRGB(0x183353);
}
-- (void)viewWillAppear:(BOOL)animated {
+- (void)viewWillAppear:(BOOL)animated {
+ UILabel *titleLabel = (UILabel *)[appDelegate makeFeedTitle:appDelegate.activeFeed];
+ titleLabel.shadowColor = UIColorFromRGB(0x306070);
+ navBar.topItem.titleView = titleLabel;
+
[self.webView loadHTMLString:[self makeTrainerSections] baseURL:nil];
}
Please sign in to comment.
Something went wrong with that request. Please try again.