@@ -22,7 +22,6 @@ import (
2222 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext"
2323 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
2424 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xslices"
25- "github.com/ydb-platform/ydb-go-sdk/v3/internal/xsync"
2625 "github.com/ydb-platform/ydb-go-sdk/v3/retry"
2726 "github.com/ydb-platform/ydb-go-sdk/v3/trace"
2827)
@@ -39,15 +38,7 @@ type Balancer struct {
3938 discover func (ctx context.Context ) (endpoints []endpoint.Endpoint , location string , err error )
4039 localDCDetector func (ctx context.Context , endpoints []endpoint.Endpoint ) (string , error )
4140
42- connectionsState atomic.Pointer [connectionsState ]
43- mu xsync.RWMutex
44- onApplyDiscoveredEndpoints []func (ctx context.Context , endpoints []endpoint.Info )
45- }
46-
47- func (b * Balancer ) OnUpdate (onApplyDiscoveredEndpoints func (ctx context.Context , endpoints []endpoint.Info )) {
48- b .mu .WithLock (func () {
49- b .onApplyDiscoveredEndpoints = append (b .onApplyDiscoveredEndpoints , onApplyDiscoveredEndpoints )
50- })
41+ connectionsState atomic.Pointer [connectionsState ]
5142}
5243
5344func (b * Balancer ) clusterDiscovery (ctx context.Context ) (err error ) {
@@ -157,12 +148,6 @@ func (b *Balancer) applyDiscoveredEndpoints(ctx context.Context, newest []endpoi
157148 }
158149
159150 b .connectionsState .Store (state )
160-
161- b .mu .WithLock (func () {
162- for _ , onApplyDiscoveredEndpoints := range b .onApplyDiscoveredEndpoints {
163- onApplyDiscoveredEndpoints (ctx , endpointsInfo )
164- }
165- })
166151}
167152
168153func (b * Balancer ) Close (ctx context.Context ) (err error ) {
0 commit comments