Skip to content

Commit

Permalink
removed pool stub
Browse files Browse the repository at this point in the history
  • Loading branch information
asmyasnikov committed Sep 6, 2024
1 parent 0a6d3b7 commit 2b869c5
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions internal/query/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

var (
_ query.Client = (*Client)(nil)
_ sessionPool = (*poolStub)(nil)
_ sessionPool = (*pool.Pool[*Session, Session])(nil)
)

Expand All @@ -41,9 +40,6 @@ type (
Stats() pool.Stats
With(ctx context.Context, f func(ctx context.Context, s *Session) error, opts ...retry.Option) error
}
poolStub struct {
createSession func(ctx context.Context) (*Session, error)
}
Client struct {
config *config.Config
queryServiceClient Ydb_Query_V1.QueryServiceClient
Expand Down Expand Up @@ -187,43 +183,6 @@ func (c *Client) ExecuteScript(
return op, nil
}

func (p *poolStub) Close(context.Context) error {
return nil
}

func (p *poolStub) Stats() pool.Stats {
return pool.Stats{
Limit: -1,
Idle: 0,
}
}

func (p *poolStub) With(
ctx context.Context, f func(ctx context.Context, s *Session) error, opts ...retry.Option,
) error {
err := retry.Retry(ctx, func(ctx context.Context) (err error) {
s, err := p.createSession(ctx)
if err != nil {
return xerrors.WithStackTrace(err)
}
defer func() {
_ = s.Close(ctx)
}()

err = f(ctx, s)
if err != nil {
return xerrors.WithStackTrace(err)
}

return nil
}, opts...)
if err != nil {
return xerrors.WithStackTrace(err)
}

return nil
}

func (c *Client) Close(ctx context.Context) error {
close(c.done)

Expand Down

0 comments on commit 2b869c5

Please sign in to comment.