MCPcopy
hub / github.com/caddyserver/certmagic / CleanUpOwnLocks

Function CleanUpOwnLocks

storage.go:293–306  ·  view source on GitHub ↗

CleanUpOwnLocks immediately cleans up all current locks obtained by this process. Since this does not cancel the operations that the locks are synchronizing, this should be called only immediately before process exit. Errors are only reported if a logger is given.

(ctx context.Context, logger *zap.Logger)

Source from the content-addressed store, hash-verified

291// called only immediately before process exit.
292// Errors are only reported if a logger is given.
293func CleanUpOwnLocks(ctx context.Context, logger *zap.Logger) {
294 locksMu.Lock()
295 defer locksMu.Unlock()
296 for lockKey, storage := range locks {
297 if err := storage.Unlock(ctx, lockKey); err != nil {
298 logger.Error("unable to clean up lock in storage backend",
299 zap.Any("storage", storage),
300 zap.String("lock_key", lockKey),
301 zap.Error(err))
302 continue
303 }
304 delete(locks, lockKey)
305 }
306}
307
308func acquireLock(ctx context.Context, storage Storage, lockKey string) error {
309 err := storage.Lock(ctx, lockKey)

Callers

nothing calls this directly

Calls 4

ErrorMethod · 0.80
StringMethod · 0.80
LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…