MCPcopy Create free account
hub / github.com/Shopify/goose / WaitOrLock

Method WaitOrLock

lockmap/map.go:21–21  ·  view source on GitHub ↗

WaitOrLock takes the lock, but only if none exists for that key. If the Promise is expired, it will successfully replace it and the previous Promise will be resolved.

(key interface{}, ttl time.Duration)

Source from the content-addressed store, hash-verified

19 // WaitOrLock takes the lock, but only if none exists for that key.
20 // If the Promise is expired, it will successfully replace it and the previous Promise will be resolved.
21 WaitOrLock(key interface{}, ttl time.Duration) (promise Promise, gotLock bool)
22
23 // Release unlocks a key and resolved the previous Promise, if any.
24 Release(key interface{})

Callers 5

ExampleNewFunction · 0.65
Test_lockMap_ReleaseFunction · 0.65
Test_lockMap_WaitFunction · 0.65
Test_lockMap_WaitOrLockFunction · 0.65
Test_lockMap_sweepFunction · 0.65

Implementers 1

lockMaplockmap/map.go

Calls

no outgoing calls

Tested by 5

ExampleNewFunction · 0.52
Test_lockMap_ReleaseFunction · 0.52
Test_lockMap_WaitFunction · 0.52
Test_lockMap_WaitOrLockFunction · 0.52
Test_lockMap_sweepFunction · 0.52