MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / UnlockMutex

Function UnlockMutex

pkg/redis/redis.go:847–853  ·  view source on GitHub ↗

UnlockMutex unlocks the key k with identifier id.

(ctx context.Context, r redis.Scripter, k, id string, expiration time.Duration)

Source from the content-addressed store, hash-verified

845
846// UnlockMutex unlocks the key k with identifier id.
847func UnlockMutex(ctx context.Context, r redis.Scripter, k, id string, expiration time.Duration) error {
848 defer trace.StartRegion(ctx, "unlock mutex").End()
849 if err := unlockMutexScript.Run(ctx, r, []string{LockKey(k), ListKey(k)}, id, milliseconds(expiration)).Err(); err != nil {
850 return ConvertError(err)
851 }
852 return nil
853}
854
855// InitMutex initializes the mutex scripts at r.
856// InitMutex must be called before mutex functionality is used in a transaction or pipeline.

Callers 2

LockedWatchFunction · 0.85
TestMutexFunction · 0.85

Calls 6

LockKeyFunction · 0.85
ListKeyFunction · 0.85
millisecondsFunction · 0.85
ConvertErrorFunction · 0.85
RunMethod · 0.65
ErrMethod · 0.45

Tested by 1

TestMutexFunction · 0.68