Skip to content
Snippets Groups Projects

gitserver: always update reclone time when recloning

Merged Warren Gifford requested to merge core/reclone into master

Created by: keegancsmith

If a repo fails to clone due to being large, we will constantly be doing a clone which uses up lots of resources. The reclone is best effort, so not doing it again soon is fine. Deciding if we need to reclone is based on the "recloneTime", which is a timestamp in the repo which is set to the time of cloning. This commit will always adjust the reclone time to halfway between the old time and now. So if the reclone fails, we will only try again in the future. In the case of normal reclone it will be 45/2=22.5 days, in the case of git.gc it will be 2/2=1 day.

This kind of behaves like a back-off, but not exactly. This behaviour was chosen since it avoids introducing new state.

We also increase the time between git gc clones to be less aggressive. This is because it is too aggressive for monorepos.

Fixes https://github.com/sourcegraph/sourcegraph/issues/7804

Merge request reports

Merged by avatar (Jul 13, 2025 6:21am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: codecov[bot]

    Codecov Report

    Merging #8069 into master will increase coverage by <.01%. The diff coverage is 77.77%.

    @@            Coverage Diff             @@
    ##           master    #8069      +/-   ##
    ==========================================
    + Coverage   40.57%   40.57%   +<.01%     
    ==========================================
      Files        1282     1282              
      Lines       66656    66660       +4     
      Branches     6310     6310              
    ==========================================
    + Hits        27046    27050       +4     
      Misses      37127    37127              
      Partials     2483     2483
    Impacted Files Coverage Δ
    cmd/gitserver/server/cleanup.go 65.3% <77.77%> (+0.4%) :arrow_up:
Please register or sign in to reply
Loading