Skip to content

Commit

Permalink
rollback changes of call stack.FunctionID("") inside select block
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Mar 24, 2024
1 parent 93219ae commit a68ebcf
Showing 2 changed files with 15 additions and 21 deletions.
22 changes: 8 additions & 14 deletions internal/query/client.go
Original file line number Diff line number Diff line change
@@ -94,22 +94,16 @@ func do(
return attempts, nil
}

func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) (err error) {
var (
onDone = trace.QueryOnDo(c.config.Trace(), &ctx,
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).Do"),
)
attempts int
)
defer func() {
onDone(attempts, err)
}()

func (c *Client) Do(ctx context.Context, op query.Operation, opts ...options.DoOption) error {
select {
case <-c.done:
return xerrors.WithStackTrace(errClosedClient)
default:
attempts, err = do(ctx, c.pool, op, c.config.Trace(), opts...)
onDone := trace.QueryOnDo(c.config.Trace(), &ctx,
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).Do"),
)
attempts, err := do(ctx, c.pool, op, c.config.Trace(), opts...)
onDone(attempts, err)

return err
}
@@ -162,8 +156,8 @@ func (c *Client) DoTx(ctx context.Context, op query.TxOperation, opts ...options
case <-c.done:
return xerrors.WithStackTrace(errClosedClient)
default:
onDone := trace.QueryOnDoTx(c.config.Trace(), &ctx, stack.FunctionID(
"github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).DoTx"),
onDone := trace.QueryOnDoTx(c.config.Trace(), &ctx,
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).DoTx"),
)
attempts, err := doTx(ctx, c.pool, op, c.config.Trace(), opts...)
onDone(attempts, err)
14 changes: 7 additions & 7 deletions internal/table/client.go
Original file line number Diff line number Diff line change
@@ -594,13 +594,6 @@ func (c *Client) Close(ctx context.Context) (err error) {
return xerrors.WithStackTrace(errNilClient)
}

onDone := trace.TableOnClose(c.config.Trace(), &ctx,
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/table.(*Client).Close"),
)
defer func() {
onDone(err)
}()

c.mu.WithLock(func() {
select {
case <-c.done:
@@ -609,6 +602,13 @@ func (c *Client) Close(ctx context.Context) (err error) {
default:
close(c.done)

onDone := trace.TableOnClose(c.config.Trace(), &ctx,
stack.FunctionID("github.com/ydb-platform/ydb-go-sdk/3/internal/table.(*Client).Close"),
)
defer func() {
onDone(err)
}()

c.limit = 0

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

0 comments on commit a68ebcf

Please sign in to comment.