From 3fda119ea35a76bc07accfdacee55cb5b6c880cf Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 2 Aug 2018 14:22:18 -0700 Subject: Make CreateGpgSignatureWorker backwards compatible with original method signature Older versions of GitPushService push a single commit SHA string to the queue, but Gitaly requires that the parameters sent by CreateGpgSignatureWorker are an array. It's possible to have old workers using this original signature or jobs in the retry queue that would fail if CreateGpgSignatureWorker can't handle the string form. --- app/workers/create_gpg_signature_worker.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/workers') diff --git a/app/workers/create_gpg_signature_worker.rb b/app/workers/create_gpg_signature_worker.rb index 91833941070..a1aeeb7c4fc 100644 --- a/app/workers/create_gpg_signature_worker.rb +++ b/app/workers/create_gpg_signature_worker.rb @@ -4,6 +4,10 @@ class CreateGpgSignatureWorker include ApplicationWorker def perform(commit_shas, project_id) + # Older versions of GitPushService may push a single commit ID on the stack. + # We need this to be backwards compatible. + commit_shas = Array(commit_shas) + return if commit_shas.empty? project = Project.find_by(id: project_id) -- cgit v1.2.1