[#694] cmd/neofs-node: Reuse single instance of client cache in all components

This will reduce amount of open connections up to 3 times.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-07-13 14:12:23 +03:00 committed by Alex Vanin
parent 38afb82926
commit fd24a99533
4 changed files with 14 additions and 21 deletions

View file

@ -14,7 +14,6 @@ import (
rtpwrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
"github.com/nspcc-dev/neofs-node/pkg/network/cache"
grpcreputation "github.com/nspcc-dev/neofs-node/pkg/network/transport/reputation/grpc"
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
reputationcommon "github.com/nspcc-dev/neofs-node/pkg/services/reputation/common"
@ -87,15 +86,11 @@ func initReputationService(c *cfg) {
},
)
apiClientCache := cache.NewSDKClientCache()
c.onShutdown(apiClientCache.CloseAll)
remoteLocalTrustProvider := common.NewRemoteTrustProvider(
common.RemoteProviderPrm{
LocalAddrSrc: c,
DeadEndProvider: daughterStorageWriterProvider,
ClientCache: apiClientCache,
ClientCache: c.clientCache,
WriterProvider: localreputation.NewRemoteProvider(
localreputation.RemoteProviderPrm{
Key: &c.key.PrivateKey,
@ -108,7 +103,7 @@ func initReputationService(c *cfg) {
common.RemoteProviderPrm{
LocalAddrSrc: c,
DeadEndProvider: consumerStorageWriterProvider,
ClientCache: apiClientCache,
ClientCache: c.clientCache,
WriterProvider: intermediatereputation.NewRemoteProvider(
intermediatereputation.RemoteProviderPrm{
Key: &c.key.PrivateKey,