diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-09 14:59:11 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-09 17:17:56 +0100 |
commit | 2ce0d06389c3eb7ac9a2b81f9fd339e7e56512bb (patch) | |
tree | 67f6a2c4880cb910d2cdfcbdd4a2e0c5ac2b6600 /spec/services | |
parent | 643c61867cc99f626d58798a5365e7573f90b176 (diff) | |
download | gitlab-ce-2ce0d06389c3eb7ac9a2b81f9fd339e7e56512bb.tar.gz |
Smarter flushing of branch statistics caches
Instead of flushing the behind/ahead counts for all branches upon every
push we now only flush the cache of branches that actually need to have
these statistics recalculated. There are now basically 2 scenarios and
their effects:
1. A user pushes a commit to the default branch, this results in the
cache being flushed for all branches.
2. A user pushes to a non default branch, this results in _only_ the
cache for that branch being flushed.
The existing code (Repository#expire_cache) remains backwards compatible
with the previous behaviour, the new behaviour is only applied when a
branch name is passed as an argument. This ensures that when for example
a project is deleted the cache for all branches is flushed.
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/git_push_service_spec.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 349809743c7..eb3a5fe43f5 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -23,7 +23,7 @@ describe GitPushService, services: true do it { is_expected.to be_truthy } it 'flushes general cached data' do - expect(project.repository).to receive(:expire_cache) + expect(project.repository).to receive(:expire_cache).with('master') subject end @@ -43,7 +43,7 @@ describe GitPushService, services: true do it { is_expected.to be_truthy } it 'flushes general cached data' do - expect(project.repository).to receive(:expire_cache) + expect(project.repository).to receive(:expire_cache).with('master') subject end @@ -63,7 +63,7 @@ describe GitPushService, services: true do end it 'flushes general cached data' do - expect(project.repository).to receive(:expire_cache) + expect(project.repository).to receive(:expire_cache).with('master') subject end |