0
0
Fork 0

Reduce number of commands in FeedManager#trim (#3989)

This commit is contained in:
Akihiko Odaki (@fn_aki@pawoo.net) 2017-06-29 08:17:26 +09:00 committed by Eugen Rochko
parent b6a19e7b89
commit 60b2b56d38
2 changed files with 14 additions and 3 deletions

View file

@ -131,4 +131,17 @@ RSpec.describe FeedManager do
end
end
end
describe '#push' do
it 'trims timelines if they will have more than FeedManager::MAX_ITEMS' do
account = Fabricate(:account)
status = Fabricate(:status)
members = FeedManager::MAX_ITEMS.times.map { |count| [count, count] }
Redis.current.zadd("feed:type:#{account.id}", members)
FeedManager.instance.push('type', account, status)
expect(Redis.current.zcard("feed:type:#{account.id}")).to eq FeedManager::MAX_ITEMS
end
end
end