BewareMyPower opened a new issue, #1270:
URL: https://github.com/apache/pulsar-client-go/issues/1270
#### Expected behavior
For a producer, when the retry time exceeds the left time when a message
would fail with timeout error, it should be reduced to be less than the left
time.
See `ProducerImpl`'s constructor in Java client:
```java
this.connectionHandler = new ConnectionHandler(this,
new BackoffBuilder()
.setInitialTime(client.getConfiguration().getInitialBackoffIntervalNanos(),
TimeUnit.NANOSECONDS)
.setMax(client.getConfiguration().getMaxBackoffIntervalNanos(),
TimeUnit.NANOSECONDS)
.setMandatoryStop(Math.max(100, conf.getSendTimeoutMs() -
100), TimeUnit.MILLISECONDS)
.create(),
```
There is a `mandatoryStop` field.
#### Actual behavior
The default backoff policy simply increases the next delay until the max
retry time (60s).
#### Steps to reproduce
```go
func TestBackoff_NextMinValue(t *testing.T) {
backoff := &DefaultBackoff{}
for i := 0; i < 10; i++ {
delay := backoff.Next()
fmt.Println(delay)
}
}
```
Modify the test above in `backoff_test.go` and run `go test -run
TestBackoff_NextMinValue` in the same directory.
```
111.555037ms
213.388077ms
466.046518ms
940.55396ms
1.614542567s
3.383705308s
6.806575903s
15.159677039s
25.637999048s
1m0.834600978s
```
#### System configuration
**Pulsar version**: x.y
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]