Reduce housekeeping executions in `Projects::AfterImportService`

In gitlab-com/gl-infra/scalability#20, we saw excessive garbage collection from pull mirrors that hadn't been changed in months.

Should Projects::AfterImportService run only once after the initial import? Import by repository URL doesn't run this for every repository mirror (https://gitlab.com/gitlab-org/gitlab-foss/blob/1bab0ba591263cd739af2d2c7c3f1b03678a59b6/app/models/project_import_state.rb#L53), yet projects imported from GitHub/Bitbucket/etc do.

Should we at least make this consistent?

Ideally, we'd only run HousekeepingService if there were any changes to the repository. I think this requires some help from the Gitaly RPC. git doesn't return any special code if the repository was changed, so we can only tell by the stdout results.

Edited Oct 08, 2019 by Stan Hu
Assignee Loading
Time tracking Loading