mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: stop mucking with user stats every 15 minutes
(pushed to twice daily)
This commit is contained in:
@@ -93,12 +93,6 @@ describe PostTiming do
|
||||
@timing_attrs = {msecs: 1234, topic_id: @post.topic_id, user_id: @coding_horror.id, post_number: @post.post_number}
|
||||
end
|
||||
|
||||
it 'creates a post timing record' do
|
||||
lambda {
|
||||
PostTiming.record_timing(@timing_attrs)
|
||||
}.should change(PostTiming, :count).by(1)
|
||||
end
|
||||
|
||||
it 'adds a view to the post' do
|
||||
lambda {
|
||||
PostTiming.record_timing(@timing_attrs)
|
||||
@@ -107,19 +101,17 @@ describe PostTiming do
|
||||
end
|
||||
|
||||
describe 'multiple calls' do
|
||||
before do
|
||||
it 'correctly works' do
|
||||
PostTiming.record_timing(@timing_attrs)
|
||||
PostTiming.record_timing(@timing_attrs)
|
||||
@timing = PostTiming.find_by(topic_id: @post.topic_id, user_id: @coding_horror.id, post_number: @post.post_number)
|
||||
timing = PostTiming.find_by(topic_id: @post.topic_id, user_id: @coding_horror.id, post_number: @post.post_number)
|
||||
|
||||
timing.should be_present
|
||||
timing.msecs.should == 2468
|
||||
|
||||
@coding_horror.user_stat.posts_read_count.should == 1
|
||||
end
|
||||
|
||||
it 'creates a timing record' do
|
||||
@timing.should be_present
|
||||
end
|
||||
|
||||
it 'sums the msecs together' do
|
||||
@timing.msecs.should == 2468
|
||||
end
|
||||
end
|
||||
|
||||
describe 'avg times' do
|
||||
|
||||
@@ -17,4 +17,14 @@ describe TopicViewItem do
|
||||
TopicViewItem.count.should == 3
|
||||
end
|
||||
|
||||
it "increases a users view count" do
|
||||
user = Fabricate(:user)
|
||||
|
||||
add(1, "1.1.1.1", user.id)
|
||||
add(1, "1.1.1.1", user.id)
|
||||
|
||||
user.user_stat.reload
|
||||
user.user_stat.topics_entered.should == 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user