summaryrefslogtreecommitdiff
path: root/app/workers/create_gpg_signature_worker.rb
diff options
context:
space:
mode:
authorLuke Bennett <lbennett@gitlab.com>2018-07-31 16:29:13 +0000
committerLuke Bennett <lbennett@gitlab.com>2018-07-31 16:29:13 +0000
commit1b27c45753a55eaba3c935138da65e3e7ff105eb (patch)
tree8637500714bde29bacd50b76bc977636362dbf32 /app/workers/create_gpg_signature_worker.rb
parent9eb87018b2659b07d5ee9c72a214987c86eca8cb (diff)
parent1a95603510accdcdb233fa00f101da119eb1fa5c (diff)
downloadgitlab-ce-1b27c45753a55eaba3c935138da65e3e7ff105eb.tar.gz
Merge branch 'master' into '41416-making-instance-wide-data-tools-more-accessible'
# Conflicts: # app/models/application_setting.rb # lib/api/settings.rb
Diffstat (limited to 'app/workers/create_gpg_signature_worker.rb')
-rw-r--r--app/workers/create_gpg_signature_worker.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/workers/create_gpg_signature_worker.rb b/app/workers/create_gpg_signature_worker.rb
index a2da1bda11f..91833941070 100644
--- a/app/workers/create_gpg_signature_worker.rb
+++ b/app/workers/create_gpg_signature_worker.rb
@@ -3,15 +3,23 @@
class CreateGpgSignatureWorker
include ApplicationWorker
- def perform(commit_sha, project_id)
+ def perform(commit_shas, project_id)
+ return if commit_shas.empty?
+
project = Project.find_by(id: project_id)
return unless project
- commit = project.commit(commit_sha)
+ commits = project.commits_by(oids: commit_shas)
- return unless commit
+ return if commits.empty?
# This calculates and caches the signature in the database
- Gitlab::Gpg::Commit.new(commit).signature
+ commits.each do |commit|
+ begin
+ Gitlab::Gpg::Commit.new(commit).signature
+ rescue => e
+ Rails.logger.error("Failed to create signature for commit #{commit.id}. Error: #{e.message}")
+ end
+ end
end
end