Skip to content

Commit

Permalink
Default timeout for topic writer connection is infinite
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby committed Apr 1, 2024
1 parent 72000e0 commit e825cab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Changed default StartTime (time of retries for connect to server) for topic writer from 1 minute to infinite (can be overrided by WithWriterStartTimeout topic option)
* Added `Struct` support for `Variant` in `ydb.ParamsBuilder()`

## v3.61.2
Expand Down
2 changes: 1 addition & 1 deletion internal/topic/retriable_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

const (
DefaultStartTimeout = time.Minute
DefaultStartTimeout = value.InfiniteDuration
connectionEstablishedTimeout = time.Minute
)

Expand Down
5 changes: 3 additions & 2 deletions internal/topic/topicwriterinternal/writer_reconnector.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ func (w *WriterReconnector) connectionLoop(ctx context.Context) {
prevAttemptTime = now

if reconnectReason != nil {
if backoff, retry := topic.CheckRetryMode(reconnectReason, w.retrySettings, w.clock.Since(startOfRetries)); retry {
retryDuration := w.clock.Since(startOfRetries)
if backoff, retry := topic.CheckRetryMode(reconnectReason, w.retrySettings, retryDuration); retry {
delay := backoff.Delay(attempt)
select {
case <-doneCtx:
Expand All @@ -389,7 +390,7 @@ func (w *WriterReconnector) connectionLoop(ctx context.Context) {
// pass
}
} else {
_ = w.close(ctx, reconnectReason)
_ = w.close(ctx, fmt.Errorf("%w, was retried (%v)", reconnectReason, retryDuration))

return
}
Expand Down

0 comments on commit e825cab

Please sign in to comment.