Skip to content

Commit 88e74f0

Browse files
committed
remove trace.ContextRetry and trace.WithRetry
1 parent d571897 commit 88e74f0

File tree

3 files changed

+1
-45
lines changed

3 files changed

+1
-45
lines changed

internal/table/retry_test.go

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/ydb-platform/ydb-go-sdk/v3/table"
1818
"github.com/ydb-platform/ydb-go-sdk/v3/table/options"
1919
"github.com/ydb-platform/ydb-go-sdk/v3/testutil"
20-
"github.com/ydb-platform/ydb-go-sdk/v3/trace"
2120
)
2221

2322
func TestRetryerBackoffRetryCancelation(t *testing.T) {
@@ -212,7 +211,6 @@ func TestRetryerImmediateReturn(t *testing.T) {
212211
// We are testing all suspentions of custom operation func against to all deadline
213212
// timeouts - all sub-tests must have latency less than timeouts (+tolerance)
214213
func TestRetryContextDeadline(t *testing.T) {
215-
tolerance := 10 * time.Millisecond
216214
timeouts := []time.Duration{
217215
50 * time.Millisecond,
218216
100 * time.Millisecond,
@@ -318,31 +316,8 @@ func TestRetryContextDeadline(t *testing.T) {
318316
t.Run(fmt.Sprintf("Timeout=%v,Sleep=%v", timeout, sleep), func(t *testing.T) {
319317
ctx, cancel := context.WithTimeout(context.Background(), timeout)
320318
defer cancel()
321-
start := time.Now()
322319
_ = do(
323-
trace.WithRetry(
324-
ctx,
325-
trace.Retry{
326-
OnRetry: func(
327-
info trace.RetryLoopStartInfo,
328-
) func(
329-
intermediateInfo trace.RetryLoopIntermediateInfo,
330-
) func(
331-
trace.RetryLoopDoneInfo,
332-
) {
333-
return func(
334-
info trace.RetryLoopIntermediateInfo,
335-
) func(trace.RetryLoopDoneInfo) {
336-
return func(info trace.RetryLoopDoneInfo) {
337-
latency := time.Since(start)
338-
if latency-timeouts[i] > tolerance {
339-
t.Errorf("unexpected latency: %v", latency)
340-
}
341-
}
342-
}
343-
},
344-
},
345-
),
320+
ctx,
346321
p,
347322
func(ctx context.Context, _ table.Session) error {
348323
select {

retry/retry.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ func WithSlowBackoff(b Backoff) retryOption {
114114
// If you need to retry your op func on some logic errors - you must return RetryableError() from retryOperation
115115
func Retry(ctx context.Context, op retryOperation, opts ...retryOption) (err error) {
116116
h := &retryOptionsHolder{
117-
trace: trace.ContextRetry(ctx),
118117
fastBackoff: FastBackoff,
119118
slowBackoff: SlowBackoff,
120119
}

trace/context.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,6 @@ package trace
22

33
import "context"
44

5-
type retryContextKey struct{}
6-
7-
// WithRetry returns deadline which has associated Retry with it.
8-
func WithRetry(ctx context.Context, t Retry) context.Context {
9-
return context.WithValue(ctx,
10-
retryContextKey{},
11-
ContextRetry(ctx).Compose(t),
12-
)
13-
}
14-
15-
// ContextRetry returns Retry associated with ctx.
16-
// If there is no Retry associated with ctx then zero value
17-
// of Retry is returned.
18-
func ContextRetry(ctx context.Context) Retry {
19-
t, _ := ctx.Value(retryContextKey{}).(Retry)
20-
return t
21-
}
22-
235
type tableContextKey struct{}
246

257
// WithTable returns deadline which has associated Trace with it.

0 commit comments

Comments
 (0)