---
title: "Comment by Mike Dabydeen on \"Your Distributed Lock Expired. Your Code Didn't.\" | Hashnode"
description: "I think the publish statement can drop AND LeaseUntilUtc &gt; SYSUTCDATETIME() without losing safety, because the generation already fences the write. If nobody"
url: "https://hashnode.com/posts/your-distributed-lock-expired-your-code-didn-t/6acde157ae82c4dc9a01de56/comment/6ace13d7a868b35039393eb6"
---

[Discussion](https://hashnode.com/posts/your-distributed-lock-expired-your-code-didn-t/6acde157ae82c4dc9a01de56)

Comment [Your Distributed Lock Expired. Your Code Didn't.](https://hashnode.com/posts/your-distributed-lock-expired-your-code-didn-t/6acde157ae82c4dc9a01de56)

[Mike Dabydeen](https://hashnode.com/@firelinks)

[Oct 13](https://hashnode.com/posts/your-distributed-lock-expired-your-code-didn-t/6acde157ae82c4dc9a01de56/comment/6ace13d7a868b35039393eb6)

I think the publish statement can drop `AND LeaseUntilUtc > SYSUTCDATETIME()` without losing safety, because the generation already fences the write. If nobody acquired after the lease ran out, Generation still matches and LeaseOwner is still the same worker, so the late write can't overwrite anyone. If someone did acquire, Generation has moved and the update matches zero rows either way. As written, a build that takes 31 seconds with no competing worker throws its result away, which is exactly the case the missing renewal loop would have to cover.

Kleppmann's 2016 locking post draws the same line: safety shouldn't rest on timing, and timeouts belong to liveness. Here the lease decides when another worker may take over, and the generation decides whose write counts. If you want a cap on how old a published report can be, I'd keep that as a separate freshness rule rather than part of the fence.

[Patrick Kearns](https://hashnode.com/@fullstackcity)

[Oct 14](https://hashnode.com/posts/your-distributed-lock-expired-your-code-didn-t/6acde157ae82c4dc9a01de56/comment/6ace13d7a868b35039393eb6#reply-6acf26b61175aa9e8a360b36)

The post deliberately applies the stricter rule that publication requires an unexpired lease, but your 31-second example highlights the cost of that choice, especially without renewal. For this report example, allowing publication until the acquisition is superseded is a better fit. Id remove that predicate and update the explanation and expiry test accordingly, keeping any source freshness requirement separate.
