0
0
Fork 0

Fix multiple boosts of a same toot erroneously appearing in TL (#14759)

* Check for and record reblog info atomically

Instead of using ZREVRANK to determine whether a reblog is a new reblog or not,
use ZADD's NX option to perform the check/addition option atomically.

* Replace ZREVRANK call with ZSCORE key which is more efficient

* Make tests a bit stricter

* Fix off-by-one
This commit is contained in:
ThibG 2020-09-07 18:00:15 +02:00 committed by GitHub
parent e79d719e92
commit 517af45e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 13 deletions

View file

@ -444,8 +444,8 @@ RSpec.describe FeedManager do
expect(Redis.current.exists?(reblog_set_key)).to be true
expect(Redis.current.zrange(reblogs_key, 0, -1)).to eq [reblogged.id.to_s]
# Push everything off the end of the feed.
FeedManager::MAX_ITEMS.times do
# Push everything past the reblog falloff.
FeedManager::REBLOG_FALLOFF.times do
FeedManager.instance.push_to_home(receiver, Fabricate(:status))
end