From 1a6d43286a3438c05bc94e24f57a177142018a4c Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Mon, 8 Jun 2026 21:47:56 +0200 Subject: [PATCH] repository: comment cleanups --- internal/repository/lock.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/repository/lock.go b/internal/repository/lock.go index d120ee943..6f43b5e6a 100644 --- a/internal/repository/lock.go +++ b/internal/repository/lock.go @@ -48,12 +48,12 @@ var lockerInst = &locker{ refreshabilityTimeout: staleLockTimeout - defaultRefreshInterval*3/2, } +// LockRepo acquires a repository lock. The returned context is cancelled when +// Unlock is called; cancelling the original context stops lock refresh. func LockRepo(ctx context.Context, repo *Repository, exclusive bool, retryLock time.Duration, printRetry func(msg string), logger func(format string, args ...interface{})) (Unlocker, context.Context, error) { return lockerInst.Lock(ctx, repo, exclusive, retryLock, printRetry, logger) } -// Lock wraps the ctx such that it is cancelled when the repository is unlocked -// cancelling the original context also stops the lock refresh func (l *locker) Lock(ctx context.Context, r *Repository, exclusive bool, retryLock time.Duration, printRetry func(msg string), logger func(format string, args ...interface{})) (*unlocker, context.Context, error) { var lock *lockHandle var err error @@ -158,7 +158,7 @@ func (l *locker) refreshLocks(ctx context.Context, backend backend.Backend, unlo debug.Log("trying to refresh stale lock") // keep on going if our current lock still exists success := tryRefreshStaleLock(ctx, backend, lock, unlocker.cancel, logger) - // inform refresh goroutine about forced refresh + // inform monitor goroutine about forced refresh select { case <-ctx.Done(): case req.result <- success: