Adding logging for blurblogs and time elapsed.

This commit is contained in:
Samuel Clay 2012-07-06 00:41:36 -07:00
parent 75c7d1960c
commit 84be44f991
2 changed files with 19 additions and 8 deletions

View file

@ -164,6 +164,7 @@ def load_social_stories(request, user_id, username=None):
}
def load_social_page(request, user_id, username=None):
start = time.time()
user = request.user
social_user_id = int(user_id)
social_user = get_object_or_404(User, pk=social_user_id)
@ -183,7 +184,9 @@ def load_social_page(request, user_id, username=None):
if len(stories) > limit:
has_next_page = True
stories = stories[:-1]
checkpoint1 = time.time()
if not stories:
return {
"user": user,
@ -206,6 +209,8 @@ def load_social_page(request, user_id, username=None):
stories, profiles = MSharedStory.stories_with_comments_and_profiles(stories, social_user.pk,
check_all=True)
checkpoint2 = time.time()
if user.is_authenticated():
for story in stories:
if user.pk in story['shared_by_friends'] or user.pk in story['shared_by_public']:
@ -226,7 +231,13 @@ def load_social_page(request, user_id, username=None):
'user_profile' : hasattr(user, 'profile') and user.profile,
'has_next_page' : has_next_page,
}
diff1 = checkpoint1-start
diff2 = checkpoint2-start
timediff = time.time()-start
logging.user(request, "~FYLoading ~FMsocial page~FY: ~SB%s%s ~SN(%.4s seconds, ~SB%.4s/%.4s~SN)" % (
social_profile.title[:22], ('~SN/p%s' % page) if page > 1 else '', timediff,
diff1, diff2))
if format == 'html':
template = 'social/social_stories.xhtml'
else:

View file

@ -34,6 +34,7 @@ NEWSBLUR.Views.SocialPage = Backbone.View.extend({
var innerheight = $button.height();
$button.removeClass('NB-loading').addClass('NB-loaded');
$button.stop(true).animate({'backgroundColor': '#86B86B'}, {'duration': 750, 'easing': 'easeOutExpo', 'queue': false});
$loaded.text('Page ' + this.page).css('bottom', height).animate({'bottom': innerheight}, {
'duration': 500,
@ -47,7 +48,6 @@ NEWSBLUR.Views.SocialPage = Backbone.View.extend({
});
clearInterval(this.feed_stories_loading);
$button.stop().animate({'backgroundColor': '#86B86B'}, {'duration': 750, 'queue': false});
$controls.after($(data));
},
@ -76,12 +76,12 @@ NEWSBLUR.Views.SocialPage = Backbone.View.extend({
});
$button.addClass('NB-loading');
$button.animate({'backgroundColor': '#5C89C9'}, 900);
$button.animate({'backgroundColor': '#5C89C9'}, 650)
.animate({'backgroundColor': '#2B478C'}, 900);
this.feed_stories_loading = setInterval(function() {
if (!$button.hasClass('NB-loaded')) return;
$button.animate({'backgroundColor': '#2B478C'}, {'duration': 650})
.animate({'backgroundColor': '#5C89C9'}, 900);
}, 1500);
$button.animate({'backgroundColor': '#5C89C9'}, {'duration': 650})
.animate({'backgroundColor': '#2B478C'}, 900);
}, 1550);
this.page += 1;