diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2019-02-14 17:07:24 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-02-14 17:07:24 +0300 |
commit | 1fc89ca9452c814d73245ec205d8e846d8760439 (patch) | |
tree | f2a2c898bc73ae0aa3fb858e054c40696b8333ac /spec/services | |
parent | ed7144ad58c32936c902d93da23eeb2159ee0158 (diff) | |
parent | a0e97b1c6a786462733a73b681cff60b103d729c (diff) |
Merge branch 'if-24642-activity_service_optimization' into 'master'
Optimize Redis usage in User::ActivityService
See merge request gitlab-org/gitlab-ce!25005
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/users/activity_service_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/services/users/activity_service_spec.rb b/spec/services/users/activity_service_spec.rb index 719b4adf212..3c0a4ac8e18 100644 --- a/spec/services/users/activity_service_spec.rb +++ b/spec/services/users/activity_service_spec.rb @@ -26,6 +26,12 @@ describe Users::ActivityService do .from(last_activity_on) .to(Date.today) end + + it 'tries to obtain ExclusiveLease' do + expect(Gitlab::ExclusiveLease).to receive(:new).and_call_original + + subject.execute + end end context 'when a bad object is passed' do @@ -46,6 +52,12 @@ describe Users::ActivityService do it 'does not update last_activity_on' do expect { subject.execute }.not_to change(user, :last_activity_on) end + + it 'does not try to obtain ExclusiveLease' do + expect(Gitlab::ExclusiveLease).not_to receive(:new) + + subject.execute + end end context 'when in GitLab read-only instance' do |