about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-09-07 18:00:15 +0200
committerGitHub <noreply@github.com>2020-09-07 18:00:15 +0200
commit517af45e32535efe1494c0e1e59304a5a7771dba (patch)
tree5862c7ec4ca28a09ba091e9c814cc9bc091d6b43 /spec
parente79d719e92e120ba3dd6ec2d8521f7aaa9482634 (diff)
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
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/feed_manager_spec.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb
index 5088d1742..d86dd7993 100644
--- a/spec/lib/feed_manager_spec.rb
+++ b/spec/lib/feed_manager_spec.rb
@@ -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