Skip to content

Commit

Permalink
use safer subtraction on healthcheck expiration check (#2272)
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan authored Nov 14, 2024
1 parent 45c9118 commit 4d0f812
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_healthcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl HealthcheckMessage {
let now_secs = u64::try_from(Utc::now().timestamp())
.map_err(|e| SignValidationError::Internal { reason: e.to_string() })?;

let remaining_expiration_secs = self.data.expires_at_secs - now_secs;
let remaining_expiration_secs = self.data.expires_at_secs.saturating_sub(now_secs);

if remaining_expiration_secs == 0 {
return Err(SignValidationError::Expired {
Expand Down

0 comments on commit 4d0f812

Please sign in to comment.