This is an automated email from the ASF dual-hosted git repository.
piotr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iggy.git
The following commit(s) were added to refs/heads/master by this push:
new 3c30a3f3 fix(sdk): fix possible monotonic time bug in Rust SDK (#2045)
3c30a3f3 is described below
commit 3c30a3f324b93a81721b6c3726c9fa58bb2ec673
Author: Piotr Gankiewicz <[email protected]>
AuthorDate: Mon Jul 28 12:02:18 2025 +0200
fix(sdk): fix possible monotonic time bug in Rust SDK (#2045)
---
core/sdk/src/clients/consumer.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/core/sdk/src/clients/consumer.rs b/core/sdk/src/clients/consumer.rs
index 1c5fb728..76a468f0 100644
--- a/core/sdk/src/clients/consumer.rs
+++ b/core/sdk/src/clients/consumer.rs
@@ -770,6 +770,14 @@ impl IggyConsumer {
}
let now: u64 = IggyTimestamp::now().into();
+ if now < last_sent_at {
+ warn!(
+ "Returned monotonic time went backwards, now < last_sent_at:
({now} < {last_sent_at})"
+ );
+ sleep(Duration::from_micros(interval)).await;
+ return;
+ }
+
let elapsed = now - last_sent_at;
if elapsed >= interval {
trace!("No need to wait before polling messages. {now} -
{last_sent_at} = {elapsed}");