Skip to content
Snippets Groups Projects
Commit a1812edb authored by Stan Hu's avatar Stan Hu Committed by Robert Speicher
Browse files

Ignore unknown project ID in RepositoryUpdateMirrorWorker

Projects that are in pending_delete could still trigger the mirror,
leading to undefined method `mark_import_as_failed` errors and
repeated Sidekiq retries.
parent 4899de87
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.13.0 (unreleased)
 
v 8.12.2 (unreleased)
- Ignore unknown project ID in RepositoryUpdateMirrorWorker
 
v 8.12.1
- Prevent secrets to be pushed to the repository
Loading
Loading
Loading
Loading
@@ -11,6 +11,9 @@ class RepositoryUpdateMirrorWorker
def perform(project_id)
begin
@project = Project.find(project_id)
return unless project
@current_user = @project.mirror_user || @project.creator
 
result = Projects::UpdateMirrorService.new(@project, @current_user).execute
Loading
Loading
@@ -21,9 +24,10 @@ class RepositoryUpdateMirrorWorker
 
project.import_finish
rescue => ex
project.mark_import_as_failed("We're sorry, a temporary error occurred, please try again.")
raise UpdateMirrorError, "#{ex.class}: #{Gitlab::UrlSanitizer.sanitize(ex.message)}"
if project
project.mark_import_as_failed("We're sorry, a temporary error occurred, please try again.")
raise UpdateMirrorError, "#{ex.class}: #{Gitlab::UrlSanitizer.sanitize(ex.message)}"
end
end
end
end
Loading
Loading
@@ -19,5 +19,9 @@ describe RepositoryUpdateMirrorWorker do
expect { described_class.new.perform(project.id) }
.to change { project.reload.import_status }.to('failed')
end
it 'does nothing if project does not exist' do
expect(described_class.new.perform(1000000)).to be_nil
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment