(userId: string, path: string, presentedToken: string)
| 108 | } |
| 109 | |
| 110 | export function releaseLock(userId: string, path: string, presentedToken: string): boolean { |
| 111 | const key = buildKey(userId, path); |
| 112 | const lock = locksByKey.get(key); |
| 113 | |
| 114 | if (!lock || isExpired(lock) || lock.token !== presentedToken) { |
| 115 | return false; |
| 116 | } |
| 117 | |
| 118 | locksByKey.delete(key); |
| 119 | |
| 120 | return true; |
| 121 | } |