gitserver: always update reclone time when recloning
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
Activity
Created by: codecov[bot]
Codecov Report
Merging #8069 into master will increase coverage by
<.01%
. The diff coverage is77.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%)