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

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


The following commit(s) were added to refs/heads/branch-2.8 by this push:
     new 623fdf9  [pulsar-client] Add conf backoff values (#12520)
623fdf9 is described below

commit 623fdf9aed5bb42b21278d2950ab05e366835eb1
Author: Callum Duffy <[email protected]>
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 <[email protected]>
    Co-authored-by: Michael Marshall <[email protected]>
    
    ### 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 b47f795..aa3728c 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
@@ -882,9 +882,9 @@ public class PulsarClientImpl implements PulsarClient {
             TopicName topicName = TopicName.get(topic);
             AtomicLong opTimeoutMs = new 
AtomicLong(conf.getOperationTimeoutMs());
             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);
         } catch (IllegalArgumentException e) {

Reply via email to