Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-05-20 13:41:13 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-05-21 17:42:16 +0300
commit0e96a90fdc8881561e7ec31b129df96015b82269 (patch)
tree7be8d22d881059830ae32498995be33f25ac59f0
parente629ea0efb9706bdb00fcb65f0171e49c20fcfb8 (diff)
catfile: Evict cached processes when stopped
When stopping the catfile batch cache, we should also evict all current entries. This fixes a bunch of races we have seen where there's still git-cat-file(1) processes around after tests have concluded.
-rw-r--r--internal/git/catfile/batch_cache.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/git/catfile/batch_cache.go b/internal/git/catfile/batch_cache.go
index 2822fdf6b..53f6e79d8 100644
--- a/internal/git/catfile/batch_cache.go
+++ b/internal/git/catfile/batch_cache.go
@@ -87,11 +87,13 @@ func NewCache(cfg config.Cfg) *BatchCache {
return newCache(defaultBatchfileTTL, cfg.Git.CatfileCacheSize, defaultEvictionInterval)
}
-// Stop stops the monitoring Goroutine. This must only be called once.
+// Stop stops the monitoring Goroutine and evicts all cached processes. This must only be called
+// once.
func (bc *BatchCache) Stop() {
bc.monitorTicker.Stop()
bc.monitorDone <- struct{}{}
<-bc.monitorDone
+ bc.Evict()
}
func newCache(ttl time.Duration, maxLen int, refreshInterval time.Duration) *BatchCache {