Fix single Redis connection being used across all threads (#18135)
* Fix single Redis connection being used across all Sidekiq threads * Fix tests
This commit is contained in:
parent
9bf04db23a
commit
3917353645
44 changed files with 243 additions and 124 deletions
|
@ -65,22 +65,22 @@ describe ApplicationController, type: :controller do
|
|||
get :show
|
||||
|
||||
expect_updated_sign_in_at(user)
|
||||
expect(Redis.current.get("account:#{user.account_id}:regeneration")).to eq 'true'
|
||||
expect(redis.get("account:#{user.account_id}:regeneration")).to eq 'true'
|
||||
expect(RegenerationWorker).to have_received(:perform_async)
|
||||
end
|
||||
|
||||
it 'sets the regeneration marker to expire' do
|
||||
allow(RegenerationWorker).to receive(:perform_async)
|
||||
get :show
|
||||
expect(Redis.current.ttl("account:#{user.account_id}:regeneration")).to be >= 0
|
||||
expect(redis.ttl("account:#{user.account_id}:regeneration")).to be >= 0
|
||||
end
|
||||
|
||||
it 'regenerates feed when sign in is older than two weeks' do
|
||||
get :show
|
||||
|
||||
expect_updated_sign_in_at(user)
|
||||
expect(Redis.current.zcard(FeedManager.instance.key(:home, user.account_id))).to eq 3
|
||||
expect(Redis.current.get("account:#{user.account_id}:regeneration")).to be_nil
|
||||
expect(redis.zcard(FeedManager.instance.key(:home, user.account_id))).to eq 3
|
||||
expect(redis.get("account:#{user.account_id}:regeneration")).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue