mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
Adding logging for blurblogs and time elapsed.
This commit is contained in:
parent
75c7d1960c
commit
84be44f991
2 changed files with 19 additions and 8 deletions
|
@ -164,6 +164,7 @@ def load_social_stories(request, user_id, username=None):
|
||||||
}
|
}
|
||||||
|
|
||||||
def load_social_page(request, user_id, username=None):
|
def load_social_page(request, user_id, username=None):
|
||||||
|
start = time.time()
|
||||||
user = request.user
|
user = request.user
|
||||||
social_user_id = int(user_id)
|
social_user_id = int(user_id)
|
||||||
social_user = get_object_or_404(User, pk=social_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:
|
if len(stories) > limit:
|
||||||
has_next_page = True
|
has_next_page = True
|
||||||
stories = stories[:-1]
|
stories = stories[:-1]
|
||||||
|
|
||||||
|
checkpoint1 = time.time()
|
||||||
|
|
||||||
if not stories:
|
if not stories:
|
||||||
return {
|
return {
|
||||||
"user": user,
|
"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,
|
stories, profiles = MSharedStory.stories_with_comments_and_profiles(stories, social_user.pk,
|
||||||
check_all=True)
|
check_all=True)
|
||||||
|
|
||||||
|
checkpoint2 = time.time()
|
||||||
|
|
||||||
if user.is_authenticated():
|
if user.is_authenticated():
|
||||||
for story in stories:
|
for story in stories:
|
||||||
if user.pk in story['shared_by_friends'] or user.pk in story['shared_by_public']:
|
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,
|
'user_profile' : hasattr(user, 'profile') and user.profile,
|
||||||
'has_next_page' : has_next_page,
|
'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':
|
if format == 'html':
|
||||||
template = 'social/social_stories.xhtml'
|
template = 'social/social_stories.xhtml'
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -34,6 +34,7 @@ NEWSBLUR.Views.SocialPage = Backbone.View.extend({
|
||||||
var innerheight = $button.height();
|
var innerheight = $button.height();
|
||||||
|
|
||||||
$button.removeClass('NB-loading').addClass('NB-loaded');
|
$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}, {
|
$loaded.text('Page ' + this.page).css('bottom', height).animate({'bottom': innerheight}, {
|
||||||
'duration': 500,
|
'duration': 500,
|
||||||
|
@ -47,7 +48,6 @@ NEWSBLUR.Views.SocialPage = Backbone.View.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
clearInterval(this.feed_stories_loading);
|
clearInterval(this.feed_stories_loading);
|
||||||
$button.stop().animate({'backgroundColor': '#86B86B'}, {'duration': 750, 'queue': false});
|
|
||||||
|
|
||||||
$controls.after($(data));
|
$controls.after($(data));
|
||||||
},
|
},
|
||||||
|
@ -76,12 +76,12 @@ NEWSBLUR.Views.SocialPage = Backbone.View.extend({
|
||||||
});
|
});
|
||||||
$button.addClass('NB-loading');
|
$button.addClass('NB-loading');
|
||||||
|
|
||||||
$button.animate({'backgroundColor': '#5C89C9'}, 900);
|
$button.animate({'backgroundColor': '#5C89C9'}, 650)
|
||||||
|
.animate({'backgroundColor': '#2B478C'}, 900);
|
||||||
this.feed_stories_loading = setInterval(function() {
|
this.feed_stories_loading = setInterval(function() {
|
||||||
if (!$button.hasClass('NB-loaded')) return;
|
$button.animate({'backgroundColor': '#5C89C9'}, {'duration': 650})
|
||||||
$button.animate({'backgroundColor': '#2B478C'}, {'duration': 650})
|
.animate({'backgroundColor': '#2B478C'}, 900);
|
||||||
.animate({'backgroundColor': '#5C89C9'}, 900);
|
}, 1550);
|
||||||
}, 1500);
|
|
||||||
|
|
||||||
this.page += 1;
|
this.page += 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue