Commit 7da4c4fc authored by Stan Hu's avatar Stan Hu

Update repository size after import

After an import by URL, only the LFS object size and commit count were
being updated. If a repository takes a while to clone, the statistics
may be stale. To prevent this we schedule a cache update when the import
is finished.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/291845
parent aec60d60
......@@ -1843,6 +1843,7 @@ class Project < ApplicationRecord
wiki.repository.expire_content_cache
DetectRepositoryLanguagesWorker.perform_async(id)
ProjectCacheWorker.perform_async(self.id, [], [:repository_size])
# The import assigns iid values on its own, e.g. by re-using GitHub ids.
# Flush existing InternalId records for this project for consistency reasons.
......
---
title: Update repository size after import
merge_request: 49319
author:
type: fixed
......@@ -4981,6 +4981,7 @@ RSpec.describe Project, factory_default: :keep do
expect(project).to receive(:after_create_default_branch)
expect(project).to receive(:refresh_markdown_cache!)
expect(InternalId).to receive(:flush_records!).with(project: project)
expect(ProjectCacheWorker).to receive(:perform_async).with(project.id, [], [:repository_size])
expect(DetectRepositoryLanguagesWorker).to receive(:perform_async).with(project.id)
expect(project).to receive(:write_repository_config)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment