make lease more robust

Signed-off-by: Yuchen Liang <yuchen@neon.tech>
This commit is contained in:
Yuchen Liang
2024-06-14 15:03:22 -04:00
parent da55eebc83
commit 723ea86f40
3 changed files with 25 additions and 16 deletions

View File

@@ -181,8 +181,8 @@ impl LsnLease {
pub const DEFAULT_LENGTH: Duration = Duration::from_secs(10 * 60);
/// Checks whether the lease is expired.
pub fn is_expired(&self) -> bool {
SystemTime::now() > self.valid_until
pub fn is_expired(&self, now: &SystemTime) -> bool {
now > &self.valid_until
}
}