You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ji...@apache.org on 2022/05/04 06:48:06 UTC
[pulsar] branch master updated: [fix][client-producer] tweak the timeout msg before opMsg flush. (#15019)
This is an automated email from the ASF dual-hosted git repository.
jianghaiting pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 9a2146b2b99 [fix][client-producer] tweak the timeout msg before opMsg flush. (#15019)
9a2146b2b99 is described below
commit 9a2146b2b99ab57c6d2424a8ce020add9a43eea3
Author: Yan Zhao <ho...@apache.org>
AuthorDate: Wed May 4 14:47:57 2022 +0800
[fix][client-producer] tweak the timeout msg before opMsg flush. (#15019)
---
.../src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
index 80a003ebd81..2a12d36d151 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
@@ -1403,15 +1403,18 @@ public class ProducerImpl<T> extends ProducerBase<T> implements TimerTask, Conne
TimeoutException te = (TimeoutException) e;
long sequenceId = te.getSequenceId();
long ns = System.nanoTime();
+ //firstSentAt and lastSentAt maybe -1, it means that the message didn't flush to channel.
String errMsg = String.format(
"%s : createdAt %s seconds ago, firstSentAt %s seconds ago, lastSentAt %s seconds ago, "
+ "retryCount %s",
te.getMessage(),
RelativeTimeUtil.nsToSeconds(ns - this.createdAt),
RelativeTimeUtil.nsToSeconds(this.firstSentAt <= 0
- ? ns - this.lastSentAt
+ ? this.firstSentAt
: ns - this.firstSentAt),
- RelativeTimeUtil.nsToSeconds(ns - this.lastSentAt),
+ RelativeTimeUtil.nsToSeconds(this.lastSentAt <= 0
+ ? this.lastSentAt
+ : ns - this.lastSentAt),
retryCount
);