Skip to content

Commit a68ebcf

Browse files
committed
rollback changes of call stack.FunctionID("") inside select block
1 parent 93219ae commit a68ebcf

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

internal/query/client.go

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

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-
97+
func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) error {
10898
select {
10999
case <-c.done:
110100
return xerrors.WithStackTrace(errClosedClient)
111101
default:
112-
attempts, err = do(ctx, c.pool, op, c.config.Trace(), opts...)
102+
onDone := trace.QueryOnDo(c.config.Trace(), &ctx,
103+
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).Do"),
104+
)
105+
attempts, err := do(ctx, c.pool, op, c.config.Trace(), opts...)
106+
onDone(attempts, err)
113107

114108
return err
115109
}
@@ -162,8 +156,8 @@ func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options
162156
case <-c.done:
163157
return xerrors.WithStackTrace(errClosedClient)
164158
default:
165-
onDone := trace.QueryOnDoTx(c.config.Trace(), &ctx, stack.FunctionID(
166-
"github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).DoTx"),
159+
onDone := trace.QueryOnDoTx(c.config.Trace(), &ctx,
160+
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).DoTx"),
167161
)
168162
attempts, err := doTx(ctx, c.pool, op, c.config.Trace(), opts...)
169163
onDone(attempts, err)

internal/table/client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,13 +594,6 @@ 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-
604597
c.mu.WithLock(func() {
605598
select {
606599
case <-c.done:
@@ -609,6 +602,13 @@ func (c *Client) Close(ctx context.Context) (err error) {
609602
default:
610603
close(c.done)
611604

605+
onDone := trace.TableOnClose(c.config.Trace(), &ctx,
606+
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/table.(*Client).Close"),
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)