fix(mesh/outbox): expire messages with zero TTL immediately

is_expired used age > ttl_secs, so a message with ttl_secs=0 whose age
rounded to 0 seconds was considered live forever. Switch to >= so the
zero-TTL boundary expires on the first check, matching the intuitive
meaning of TTL and the behavior the tests assert.
This commit is contained in:
archipelago
2026-04-23 13:02:07 -04:00
parent a8862d4fe1
commit ebb5443309

View File

@@ -52,7 +52,10 @@ impl PendingMessage {
return true; // Can't parse = treat as expired
};
let age = chrono::Utc::now().signed_duration_since(created);
age.num_seconds() as u64 > self.ttl_secs
// Use `>=` so a ttl_secs=0 message is expired immediately (used by
// tests and by callers that want a fire-and-forget behavior when
// the relay can't deliver on first try).
age.num_seconds() as u64 >= self.ttl_secs
}
/// Check if this message can be relayed further.