Skip to content

Commit

Permalink
Avoid syncing extra details for forks
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Oct 20, 2023
1 parent 8f6d09b commit a720813
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion app/models/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,15 @@ 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
SyncExtraDetailsWorker.perform_async(self.id)
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
Expand Down
2 changes: 1 addition & 1 deletion app/sidekiq/ping_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a720813

Please sign in to comment.