0
0
Fork 0

Do not push status to feed if its reblog is already inserted (#6488)

A complemental change for precompute_feed_service_spec.rb also fixes its
random failure which is caused by the Snowlake randomization of the order
of an original status and its reblog.
This commit is contained in:
Akihiko Odaki 2018-02-24 13:40:18 +09:00 committed by Eugen Rochko
parent e668180044
commit f8f0572ee0
4 changed files with 45 additions and 7 deletions

View file

@ -9,14 +9,11 @@ RSpec.describe PrecomputeFeedService do
let(:account) { Fabricate(:account) }
it 'fills a user timeline with statuses' do
account = Fabricate(:account)
followed_account = Fabricate(:account)
Fabricate(:follow, account: account, target_account: followed_account)
reblog = Fabricate(:status, account: followed_account)
status = Fabricate(:status, account: account, reblog: reblog)
status = Fabricate(:status, account: account)
subject.call(account)
expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to be_within(0.1).of(status.id.to_f)
expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), status.id)).to be_within(0.1).of(status.id.to_f)
end
it 'does not raise an error even if it could not find any status' do