Commit c00264ec authored by Valery Sizov's avatar Valery Sizov

Fix of Commit search breaks for some URLs on gitlab-ce project

parent 56b36c91
...@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.11.0 (unreleased) v 8.11.0 (unreleased)
- Performance improvement of push rules - Performance improvement of push rules
- Change LdapGroupSyncWorker to use new LDAP group sync classes - Change LdapGroupSyncWorker to use new LDAP group sync classes
- [Elastic][Fix] Commit search breaks for some URLs on gitlab-ce project
v 8.10.3 (unreleased) v 8.10.3 (unreleased)
- Fix regression in Git Annex permission check - Fix regression in Git Annex permission check
......
...@@ -49,6 +49,10 @@ class GitPushService < BaseService ...@@ -49,6 +49,10 @@ class GitPushService < BaseService
update_gitattributes if is_default_branch? update_gitattributes if is_default_branch?
end end
if current_application_settings.elasticsearch_indexing? && is_default_branch?
ElasticCommitIndexerWorker.perform_async(@project.id, params[:oldrev], params[:newrev])
end
# Update merge requests that may be affected by this push. A new branch # Update merge requests that may be affected by this push. A new branch
# could cause the last commit of a merge request to change. # could cause the last commit of a merge request to change.
update_merge_requests update_merge_requests
...@@ -73,10 +77,6 @@ class GitPushService < BaseService ...@@ -73,10 +77,6 @@ class GitPushService < BaseService
CreateCommitBuildsService.new.execute(@project, current_user, build_push_data, mirror_update: mirror_update) CreateCommitBuildsService.new.execute(@project, current_user, build_push_data, mirror_update: mirror_update)
ProjectCacheWorker.perform_async(@project.id) ProjectCacheWorker.perform_async(@project.id)
if current_application_settings.elasticsearch_indexing?
ElasticCommitIndexerWorker.perform_async(@project.id, params[:oldrev], params[:newrev])
end
end end
def perform_housekeeping def perform_housekeeping
......
...@@ -179,10 +179,16 @@ describe GitPushService, services: true do ...@@ -179,10 +179,16 @@ describe GitPushService, services: true do
stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false) stub_application_setting(elasticsearch_search: false, elasticsearch_indexing: false)
end end
it "triggers indexer" do it "does not trigger indexer when push to non-default branch" do
expect_any_instance_of(Gitlab::Elastic::Indexer).not_to receive(:run)
execute_service(project, user, @oldrev, @newrev, 'refs/heads/other')
end
it "triggers indexer when push to default branch" do
expect_any_instance_of(Gitlab::Elastic::Indexer).to receive(:run) expect_any_instance_of(Gitlab::Elastic::Indexer).to receive(:run)
execute_service(project, user, @oldrev, @newrev, @ref ) execute_service(project, user, @oldrev, @newrev, 'refs/heads/master')
end end
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