From 2b3d6969c6c4510493f328c9c773db75b8ae9650 Mon Sep 17 00:00:00 2001 From: Daniil Cherednik Date: Fri, 1 Nov 2024 17:08:40 +0100 Subject: [PATCH] fic --- internal/pool/pool.go | 1 - internal/pool/pool_test.go | 17 +++++++---------- internal/query/client.go | 4 ++-- internal/query/client_test.go | 2 +- internal/table/client.go | 4 ++-- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/internal/pool/pool.go b/internal/pool/pool.go index d4a11ca5d..223b538ed 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -605,7 +605,6 @@ func (p *Pool[PT, T]) getItem(ctx context.Context, preferredNodeID uint32) (item if item := xsync.WithLock(&p.mu, func() PT { //nolint:nestif return p.removeFirstIdle(preferredNodeID) }); item != nil { - if item.IsAlive() { info := xsync.WithLock(&p.mu, func() itemInfo[PT, T] { info, has := p.index[item] diff --git a/internal/pool/pool_test.go b/internal/pool/pool_test.go index 15ebb5855..52d75df3e 100644 --- a/internal/pool/pool_test.go +++ b/internal/pool/pool_test.go @@ -256,17 +256,14 @@ func TestPool(t *testing.T) { //nolint:gocyclo var newSessionCalled uint32 p := New[*testItem, testItem](rootCtx, WithTrace[*testItem, testItem](defaultTrace), - WithCreateItemFunc(func(ctx context.Context, nodeId uint32) (*testItem, error) { - _ = ctx + WithCreateItemFunc(func(_ context.Context, nodeId uint32) (*testItem, error) { newSessionCalled++ - var ( - v = testItem{ - v: 0, - onNodeID: func() uint32 { - return nodeId - }, - } - ) + v := testItem{ + v: 0, + onNodeID: func() uint32 { + return nodeId + }, + } return &v, nil }), ) diff --git a/internal/query/client.go b/internal/query/client.go index 6a6aaf9a6..f3963848d 100644 --- a/internal/query/client.go +++ b/internal/query/client.go @@ -2,8 +2,6 @@ package query import ( "context" - "github.com/ydb-platform/ydb-go-sdk/v3/internal/conn" - balancerContext "github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint" "time" "github.com/ydb-platform/ydb-go-genproto/Ydb_Query_V1" @@ -13,6 +11,8 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/allocator" "github.com/ydb-platform/ydb-go-sdk/v3/internal/closer" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/conn" + balancerContext "github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint" "github.com/ydb-platform/ydb-go-sdk/v3/internal/operation" "github.com/ydb-platform/ydb-go-sdk/v3/internal/pool" "github.com/ydb-platform/ydb-go-sdk/v3/internal/query/config" diff --git a/internal/query/client_test.go b/internal/query/client_test.go index 0a0a6dd7c..e05436196 100644 --- a/internal/query/client_test.go +++ b/internal/query/client_test.go @@ -1590,7 +1590,7 @@ func testPool( ) *pool.Pool[*Session, Session] { return pool.New[*Session, Session](ctx, pool.WithLimit[*Session, Session](1), - pool.WithCreateItemFunc(func (ctx context.Context, _ uint32) (*Session, error) { + pool.WithCreateItemFunc(func(ctx context.Context, _ uint32) (*Session, error) { return createSession(ctx) }), pool.WithSyncCloseItem[*Session, Session](), diff --git a/internal/table/client.go b/internal/table/client.go index d5983aa6d..5142402b4 100644 --- a/internal/table/client.go +++ b/internal/table/client.go @@ -2,14 +2,14 @@ package table import ( "context" - "github.com/ydb-platform/ydb-go-sdk/v3/internal/conn" - balancerContext "github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint" "github.com/jonboulle/clockwork" "github.com/ydb-platform/ydb-go-genproto/Ydb_Table_V1" "google.golang.org/grpc" "github.com/ydb-platform/ydb-go-sdk/v3/internal/allocator" + "github.com/ydb-platform/ydb-go-sdk/v3/internal/conn" + balancerContext "github.com/ydb-platform/ydb-go-sdk/v3/internal/endpoint" "github.com/ydb-platform/ydb-go-sdk/v3/internal/pool" "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack" "github.com/ydb-platform/ydb-go-sdk/v3/internal/table/config"