Skip to content

Commit

Permalink
[pulsar-client] Add conf backoff values (apache#12520)
Browse files Browse the repository at this point in the history
* add conf backoff values

* Apply suggestions from code review

Co-authored-by: Callum Duffy <callum.duffy@toasttab.com>
Co-authored-by: Michael Marshall <mikemarsh17@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.
  • Loading branch information
callumduffy authored and nicklixinyang committed Apr 20, 2022
1 parent d59f5fd commit 7937348
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,9 @@ public CompletableFuture<PartitionedTopicMetadata> getPartitionedTopicMetadata(S
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<>());
Expand Down

0 comments on commit 7937348

Please sign in to comment.