Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,17 @@ impl Storage {
message::ReaderOptions::new(),
)?;
let lease_entry_reader = lease_msg.get_root::<protocol::lease_entry::Reader>()?;

// If the lease entry itself indicates an expiry in the future, this
// expiry index key is stale (e.g., the lease was extended). In that
// case, clean up the stale index key and skip expiring this lease.
let lease_expiry_ts_secs = lease_entry_reader.get_expiry_ts_secs();
if lease_expiry_ts_secs > now_secs {
// Delete the stale index entry and continue. Do not count as processed.
expiry_index_keys_to_delete.push(idx_key.to_vec());
continue;
}

let keys = lease_entry_reader.get_ids()?;

// Reuse capnp builder and output buffer across items to reduce allocations.
Expand Down
Loading