You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by pi...@apache.org on 2025/07/28 09:37:18 UTC

(iggy) branch fix_sleep_poll created (now 46a96380)

This is an automated email from the ASF dual-hosted git repository.

piotr pushed a change to branch fix_sleep_poll
in repository https://gitbox.apache.org/repos/asf/iggy.git


      at 46a96380 fix(sdk): fix possible monotonic time bug in Rust SDK

This branch includes the following new commits:

     new 46a96380 fix(sdk): fix possible monotonic time bug in Rust SDK

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(iggy) 01/01: fix(sdk): fix possible monotonic time bug in Rust SDK

Posted by pi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

piotr pushed a commit to branch fix_sleep_poll
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 46a96380b1937c843518b78fbf612d41251c560b
Author: spetz <pi...@gmail.com>
AuthorDate: Mon Jul 28 11:37:02 2025 +0200

    fix(sdk): fix possible monotonic time bug in Rust SDK
---
 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}");