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)
| 1640 | // - ctx context.Context: The context for the operation. |
| 1641 | // - locker *redlock.MultiLocker: The MultiLocker object representing the acquired locks. |
| 1642 | func (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. |
no test coverage detected