You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/02/16 01:16:02 UTC

[pulsar] 01/08: [pulsar-client] Add conf backoff values (#12520)

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

penghui pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 9b37232a3a606b4062798f02680e88cbfc1f6faa
Author: Callum Duffy <ca...@gmail.com>
AuthorDate: Fri Feb 11 22:08:05 2022 +0000

    [pulsar-client] Add conf backoff values (#12520)
    
    * add conf backoff values
    
    * Apply suggestions from code review
    
    Co-authored-by: Callum Duffy <ca...@toasttab.com>
    Co-authored-by: Michael Marshall <mi...@gmail.com>
    
    ### Motivation
    
    Allowing services waiting on pulsar container etc to use the backoff values given in the config when the client is initialised. Using a service where i handle the future on my side, but i feel this should be in the service as is!
    
    ### Modifications
    
    Edit the values used for the backoff to use the client values.
    Defaults are the exact same as the values used previous to this change.
    
    (cherry picked from commit 970363c84d42b5d64ce55cb9eca3eb5bc716131b)
---
 .../src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
index c5195c9..0ab7a13 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
@@ -885,9 +885,9 @@ public class PulsarClientImpl implements PulsarClient {
             TopicName topicName = TopicName.get(topic);
             AtomicLong opTimeoutMs = new AtomicLong(conf.getLookupTimeoutMs());
             Backoff backoff = new BackoffBuilder()
-                    .setInitialTime(100, TimeUnit.MILLISECONDS)
+                    .setInitialTime(conf.getInitialBackoffIntervalNanos(), TimeUnit.NANOSECONDS)
                     .setMandatoryStop(opTimeoutMs.get() * 2, TimeUnit.MILLISECONDS)
-                    .setMax(1, TimeUnit.MINUTES)
+                    .setMax(conf.getMaxBackoffIntervalNanos(), TimeUnit.NANOSECONDS)
                     .create();
             getPartitionedTopicMetadata(topicName, backoff, opTimeoutMs,
                                         metadataFuture, new ArrayList<>());