Skip to content

Fix int_latency calculation for infinite timeout#5335

Open
Dmitriy Kargapolov (x0id) wants to merge 1 commit intoconfluentinc:masterfrom
x0id:fix-int-latency-calc
Open

Fix int_latency calculation for infinite timeout#5335
Dmitriy Kargapolov (x0id) wants to merge 1 commit intoconfluentinc:masterfrom
x0id:fix-int-latency-calc

Conversation

@x0id
Copy link

@x0id Dmitriy Kargapolov (x0id) commented Feb 28, 2026

Before the fix:

int_latency_base = now + (message_timeout_ms * 1000);
rd_avg_add(&rkb->rkb_avg_int_latency, int_latency_base - rkm->rkm_ts_timeout);

When message_timeout_ms = 0:
int_latency_base = now + 0 = now
rkm_ts_timeout = INT64_MAX (for infinite timeout)
Result: now - INT64_MAX = massive negative number

After the fix:

rd_avg_add(&rkb->rkb_avg_int_latency, now - rkm->rkm_ts_enq);

Always works regardless of timeout setting:
now - rkm_ts_enq = current_time - enqueue_time = actual queue time

// Before the fix:
int_latency_base = now + (message_timeout_ms * 1000);
rd_avg_add(&rkb->rkb_avg_int_latency, int_latency_base - rkm->rkm_ts_timeout);

// When message_timeout_ms = 0:
// int_latency_base = now + 0 = now
// rkm_ts_timeout = INT64_MAX (for infinite timeout)
// Result: now - INT64_MAX = massive negative number

// After the fix:
rd_avg_add(&rkb->rkb_avg_int_latency, now - rkm->rkm_ts_enq);

// Always works regardless of timeout setting:
// now - rkm_ts_enq = current_time - enqueue_time = actual queue time
@x0id Dmitriy Kargapolov (x0id) requested a review from a team as a code owner February 28, 2026 04:23
@confluent-cla-assistant
Copy link

confluent-cla-assistant bot commented Feb 28, 2026

🎉 All Contributor License Agreements have been signed. Ready to merge.
✅ x0id
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant