MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / releaseLock

Method releaseLock

transaction.go:1642–1652  ·  view source on GitHub ↗

releaseLock releases the distributed locks acquired for a transaction. It starts a tracing span, attempts to release all locks, and records relevant events and errors. Parameters: - ctx context.Context: The context for the operation. - locker *redlock.MultiLocker: The MultiLocker object representin

(ctx context.Context, locker *redlock.MultiLocker)

Source from the content-addressed store, hash-verified

1640// - ctx context.Context: The context for the operation.
1641// - locker *redlock.MultiLocker: The MultiLocker object representing the acquired locks.
1642func (l *LedgerForge) releaseLock(ctx context.Context, locker *redlock.MultiLocker) {
1643 ctx, span := tracer.Start(ctx, "ReleaseLock")
1644 defer span.End()
1645
1646 // Attempt to release all locks
1647 if err := locker.Unlock(ctx); err != nil {
1648 span.RecordError(err)
1649 logrus.WithError(err).Error("failed to release lock")
1650 }
1651 span.AddEvent("Locks released")
1652}
1653
1654// logAndRecordError logs an error message and records the error in the tracing span.
1655// It returns a formatted error message combining the provided message and the original error.

Callers 4

executeWithLockMethod · 0.95
processLineageCreditMethod · 0.95
processLineageDebitMethod · 0.95

Calls 3

StartMethod · 0.45
UnlockMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected