diff --git a/CHANGELOG.md b/CHANGELOG.md index c56a6dc38..6cb53f1d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/internal/topic/retriable_error.go b/internal/topic/retriable_error.go index 23ef3c49c..6276bc176 100644 --- a/internal/topic/retriable_error.go +++ b/internal/topic/retriable_error.go @@ -13,7 +13,7 @@ import ( ) const ( - DefaultStartTimeout = time.Minute + DefaultStartTimeout = value.InfiniteDuration connectionEstablishedTimeout = time.Minute ) diff --git a/internal/topic/topicwriterinternal/writer_reconnector.go b/internal/topic/topicwriterinternal/writer_reconnector.go index dd7c1b72d..1faea8d66 100644 --- a/internal/topic/topicwriterinternal/writer_reconnector.go +++ b/internal/topic/topicwriterinternal/writer_reconnector.go @@ -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: @@ -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 }