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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

impl PopMessageRequestHeader {
pub fn is_timeout_too_much(&self) -> bool {
get_current_millis() - self.born_time - self.poll_time > 500
get_current_millis() as i64 - self.born_time as i64 - self.poll_time as i64 > 500

Check warning on line 57 in rocketmq-remoting/src/protocol/header/pop_message_request_header.rs

View check run for this annotation

Codecov / codecov/patch

rocketmq-remoting/src/protocol/header/pop_message_request_header.rs#L57

Added line #L57 was not covered by tests
Copy link

Copilot AI Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that casting to i64 does not introduce negative values in cases where the current time is less than the sum of born_time and poll_time; consider using saturating subtraction if negative differences are not expected.

Suggested change
get_current_millis() as i64 - self.born_time as i64 - self.poll_time as i64 > 500
(get_current_millis() as i64).saturating_sub(self.born_time as i64).saturating_sub(self.poll_time as i64) > 500

Copilot uses AI. Check for mistakes.
}
}

Expand Down
Loading