(lockKey: string, value: string)
| 247 | * When Redis is not available, returns true (no-op) since no lock was held. |
| 248 | */ |
| 249 | export async function releaseLock(lockKey: string, value: string): Promise<boolean> { |
| 250 | const redis = getRedisClient() |
| 251 | if (!redis) { |
| 252 | return true // No-op when Redis unavailable; no lock was actually held |
| 253 | } |
| 254 | |
| 255 | const result = await redis.eval(RELEASE_LOCK_SCRIPT, 1, lockKey, value) |
| 256 | return result === 1 |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Extend the TTL of a distributed lock if still owned by the caller. |
no test coverage detected