MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / hostLock

Method hostLock

server-source-code/internal/context/pool_cache.go:49–52  ·  view source on GitHub ↗

hostLock returns a per-host mutex so that only requests for the same host block each other during migration/pool creation, not all hosts.

(key string)

Source from the content-addressed store, hash-verified

47// hostLock returns a per-host mutex so that only requests for the same host
48// block each other during migration/pool creation, not all hosts.
49func (c *PoolCache) hostLock(key string) *sync.Mutex {
50 v, _ := c.hostMu.LoadOrStore(key, &sync.Mutex{})
51 return v.(*sync.Mutex)
52}
53
54// GetOrCreate returns the database for the given host, creating it on first access.
55// Runs migrations before creating the pool. Returns nil if the host is not found or suspended.

Callers 1

GetOrCreateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected