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

hgruszecki pushed a commit to branch fix/producer-shard-last_flush
in repository https://gitbox.apache.org/repos/asf/iggy.git

commit 33079bb70fce05cd0511479ba9342b768d846ca9
Author: Frank Bell <[email protected]>
AuthorDate: Mon Dec 8 14:31:54 2025 +0000

    fix(sdk): update last_flush on empty buffer to prevent busy-loop
    
    When the linger timeout fires with an empty buffer, last_flush was not
    updated. This caused the next deadline to be in the past, making
    sleep_until return immediately and creating a tight loop with 100%+ CPU
    per shard.
---
 core/sdk/src/clients/producer_sharding.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/sdk/src/clients/producer_sharding.rs 
b/core/sdk/src/clients/producer_sharding.rs
index 49c2e17a7..8bdca2213 100644
--- a/core/sdk/src/clients/producer_sharding.rs
+++ b/core/sdk/src/clients/producer_sharding.rs
@@ -164,8 +164,8 @@ impl Shard {
                     _ = tokio::time::sleep_until(deadline) => {
                         if !buffer.is_empty() {
                             Self::flush_buffer(&core, &mut buffer, &mut 
buffer_bytes, &err_sender).await;
-                            last_flush = tokio::time::Instant::now();
                         }
+                        last_flush = tokio::time::Instant::now();
                     }
                     _ = stop_rx.recv() => {
                         closed_clone.store(true, Ordering::Release);

Reply via email to