From a7208131322c5a812e46bed5ece96342d76c4ced Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Fri, 20 Oct 2023 07:54:28 +0100 Subject: [PATCH] Avoid syncing extra details for forks --- app/models/host.rb | 2 +- app/models/repository.rb | 3 ++- app/sidekiq/ping_worker.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/host.rb b/app/models/host.rb index 268607ba..c7d1b950 100644 --- a/app/models/host.rb +++ b/app/models/host.rb @@ -79,7 +79,7 @@ def sync_repository(full_name) end repo.save repo.ping_packages_async if repo_changed && repo.persisted? - repo.sync_extra_details_async if repo_changed && repo.persisted? && repo.files_changed? + repo.sync_extra_details_async if !repo.fork? && repo_changed && repo.persisted? && repo.files_changed? repo.sync_owner repo end diff --git a/app/models/repository.rb b/app/models/repository.rb index dae75edf..afd3c72d 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -211,7 +211,7 @@ def delete_old_manifests(new_manifests) end def self.sync_extra_details_async - Repository.where(files_changed: true).limit(600).order('pushed_at asc').select('id').each(&:sync_extra_details_async) + Repository.where(files_changed: true, fork: false).limit(600).order('pushed_at asc').select('id').each(&:sync_extra_details_async) end def sync_extra_details_async @@ -219,6 +219,7 @@ def sync_extra_details_async end def sync_extra_details + return if fork? return unless files_changed? if pushed_at.present? parse_dependencies unless dependencies_parsed_at.present? && dependencies_parsed_at > pushed_at diff --git a/app/sidekiq/ping_worker.rb b/app/sidekiq/ping_worker.rb index 16fa6ee0..63ce1be1 100644 --- a/app/sidekiq/ping_worker.rb +++ b/app/sidekiq/ping_worker.rb @@ -15,7 +15,7 @@ def perform(host_name, full_name) end repository.sync_async - repository.sync_extra_details_async if repository.files_changed? + repository.sync_extra_details_async if !repository.fork? && repository.files_changed? else host.sync_repository_async(full_name) end