diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-16 20:26:38 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-16 20:26:38 +0000 |
commit | 971e040c00a14d7fbdfed5f45d6978a2c6b4f4f5 (patch) | |
tree | 0562c25e5219edb26736f2cd6a888f1cbc0b222f /app/workers | |
parent | 504ed1c4a44f3b86ce2ce1a545236c8c0f84c17f (diff) | |
parent | 97c2564ffac057f1830d008269f90afa9e12f815 (diff) | |
download | gitlab-ce-971e040c00a14d7fbdfed5f45d6978a2c6b4f4f5.tar.gz |
Merge branch 'dm-process-commit-worker-n+1' into 'master'
Look up upstream commits once before queuing ProcessCommitWorkers
Closes #65464
See merge request gitlab-org/gitlab-ce!31871
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/process_commit_worker.rb | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/app/workers/process_commit_worker.rb b/app/workers/process_commit_worker.rb index 3efb5343a96..f6ebe4ab006 100644 --- a/app/workers/process_commit_worker.rb +++ b/app/workers/process_commit_worker.rb @@ -2,7 +2,8 @@ # Worker for processing individual commit messages pushed to a repository. # -# Jobs for this worker are scheduled for every commit that is being pushed. As a +# Jobs for this worker are scheduled for every commit that contains mentionable +# references in its message and does not exist in the upstream project. As a # result of this the workload of this worker should be kept to a bare minimum. # Consider using an extra worker if you need to add any extra (and potentially # slow) processing of commits. @@ -19,7 +20,6 @@ class ProcessCommitWorker project = Project.find_by(id: project_id) return unless project - return if commit_exists_in_upstream?(project, commit_hash) user = User.find_by(id: user_id) @@ -77,17 +77,4 @@ class ProcessCommitWorker Commit.from_hash(hash, project) end - - private - - # Avoid reprocessing commits that already exist in the upstream - # when project is forked. This will also prevent duplicated system notes. - def commit_exists_in_upstream?(project, commit_hash) - upstream_project = project.fork_source - - return false unless upstream_project - - commit_id = commit_hash.with_indifferent_access[:id] - upstream_project.commit(commit_id).present? - end end |