Commit cb51f541 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch...

Merge branch '195988-git-clone-over-https-on-geo-secondary-triggers-attempted-project-statistics-write-to-database' into 'master'

Git clone over HTTP(S) does not update project statistics on a read-only instance

See merge request gitlab-org/gitlab!22731
parents fbd3dabd 582ec28b
...@@ -75,6 +75,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController ...@@ -75,6 +75,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController
end end
def enqueue_fetch_statistics_update def enqueue_fetch_statistics_update
return if Gitlab::Database.read_only?
return if repo_type.wiki? return if repo_type.wiki?
return unless project&.daily_statistics_enabled? return unless project&.daily_statistics_enabled?
......
...@@ -90,6 +90,16 @@ describe Projects::GitHttpController do ...@@ -90,6 +90,16 @@ describe Projects::GitHttpController do
post :git_upload_pack, params: params post :git_upload_pack, params: params
end end
context 'on a read-only instance' do
before do
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
end
it 'does not update project statistics' do
expect(ProjectDailyStatisticsWorker).not_to receive(:perform_async)
end
end
it 'updates project statistics' do it 'updates project statistics' do
expect(ProjectDailyStatisticsWorker).to receive(:perform_async) expect(ProjectDailyStatisticsWorker).to receive(:perform_async)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment