gitserver: remove stale commit-graph.lock
Created by: stefanhengl
We have seen that, occasionally, commit-graph.locks prevent a git repack from succeeding. Benchmarks on our dogfood cluster have shown that a commit-graph call for a 5GB bare repository takes less than 1 min. The lock is only held during a short period during this time. A 1-hour grace period is very conservative.
Test Plan:
(1) I ran "git commit-graph write" for the megarepo on the dogfood cluster to get a sense of a meaningful graceperiod.
(2) I ran a local instance of Sourcegraph and manually created a commit-graph.lock file.
cd .sourcegraph/repos/github.com/sourcegraph/sourcegraph/.git/objects/info
touch commit-graph.lock
I monitored the cleanup cycles and confirmed that the lock file stays in place.
I updated the lock file's timestamp.
touch -t <1 hour prior> commit-graph.lock
The lock file was removed.
(3) added a unit test