diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-03-09 15:16:21 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-03-09 15:16:21 +0300 |
commit | 80056dad431eea918fd836a74589441a5e69e89b (patch) | |
tree | a3c973692fb6ae471a980f8b9896a5e80784ff0d | |
parent | 25f72bf5a5ee424259a0410ef483bba951fe254c (diff) |
catfile: Rename `returnWhenDone` to clarify its meaning
The function `returnWhenDone()` reads as if it's only going to return
when the call is done. While that property actually holds, it is not
what the function's intent is. Instead, it returns the catfile process
back to the cache when it's done.
Rename the function to `returnToCacheWhenDone()` to make its intent
clearer.
-rw-r--r-- | internal/git/catfile/batch.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/git/catfile/batch.go b/internal/git/catfile/batch.go index 1080f0c8c..a59f74973 100644 --- a/internal/git/catfile/batch.go +++ b/internal/git/catfile/batch.go @@ -157,7 +157,7 @@ func New(ctx context.Context, gitCmdFactory git.CommandFactory, repo repository. requestDone := ctx.Done() if c, ok := cache.Checkout(cacheKey); ok { - go returnWhenDone(requestDone, cache, cacheKey, c) + go returnToCacheWhenDone(requestDone, cache, cacheKey, c) return newInstrumentedBatch(c), nil } @@ -171,12 +171,12 @@ func New(ctx context.Context, gitCmdFactory git.CommandFactory, repo repository. } c.cancel = cacheCancel - go returnWhenDone(requestDone, cache, cacheKey, c) + go returnToCacheWhenDone(requestDone, cache, cacheKey, c) return newInstrumentedBatch(c), nil } -func returnWhenDone(done <-chan struct{}, bc *batchCache, cacheKey key, c *batch) { +func returnToCacheWhenDone(done <-chan struct{}, bc *batchCache, cacheKey key, c *batch) { <-done if c == nil || c.isClosed() { |