Skip to content

Commit dca816e

Browse files
committed
fix
1 parent 7dcfcc2 commit dca816e

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

internal/query/client.go

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,22 @@ func do(
9494
return attempts, nil
9595
}
9696

97-
func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) error {
97+
func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) (err error) {
98+
var (
99+
onDone = trace.QueryOnDo(c.config.Trace(), &ctx,
100+
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).Do"),
101+
)
102+
attempts int
103+
)
104+
defer func() {
105+
onDone(attempts, err)
106+
}()
107+
98108
select {
99109
case <-c.done:
100110
return xerrors.WithStackTrace(errClosedClient)
101111
default:
102-
onDone := trace.QueryOnDo(c.config.Trace(), &ctx,
103-
stack.FunctionID(""),
104-
)
105-
attempts, err := do(ctx, c.pool, op, c.config.Trace(), opts...)
106-
onDone(attempts, err)
112+
attempts, err = do(ctx, c.pool, op, c.config.Trace(), opts...)
107113

108114
return err
109115
}
@@ -151,16 +157,22 @@ func doTx(
151157
return attempts, nil
152158
}
153159

154-
func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options.DoTxOption) error {
160+
func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options.DoTxOption) (err error) {
161+
var (
162+
onDone = trace.QueryOnDoTx(c.config.Trace(), &ctx,
163+
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).DoTx"),
164+
)
165+
attempts int
166+
)
167+
defer func() {
168+
onDone(attempts, err)
169+
}()
170+
155171
select {
156172
case <-c.done:
157173
return xerrors.WithStackTrace(errClosedClient)
158174
default:
159-
onDone := trace.QueryOnDoTx(c.config.Trace(), &ctx,
160-
stack.FunctionID(""),
161-
)
162-
attempts, err := doTx(ctx, c.pool, op, c.config.Trace(), opts...)
163-
onDone(attempts, err)
175+
attempts, err = doTx(ctx, c.pool, op, c.config.Trace(), opts...)
164176

165177
return err
166178
}

internal/table/client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,13 @@ func (c *Client) Close(ctx context.Context) (err error) {
594594
return xerrors.WithStackTrace(errNilClient)
595595
}
596596

597+
onDone := trace.TableOnClose(c.config.Trace(), &ctx,
598+
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/table.(*Client).Close"),
599+
)
600+
defer func() {
601+
onDone(err)
602+
}()
603+
597604
c.mu.WithLock(func() {
598605
select {
599606
case <-c.done:
@@ -602,13 +609,6 @@ func (c *Client) Close(ctx context.Context) (err error) {
602609
default:
603610
close(c.done)
604611

605-
onDone := trace.TableOnClose(c.config.Trace(), &ctx,
606-
stack.FunctionID(""),
607-
)
608-
defer func() {
609-
onDone(err)
610-
}()
611-
612612
c.limit = 0
613613

614614
for el := c.waitQ.Front(); el != nil; el = el.Next() {

0 commit comments

Comments
 (0)