1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-10 01:51:11 +09:00

pp/ns: extra log msgs and comments

This commit is contained in:
Anthony Akentiev 2024-10-31 17:12:10 +00:00
parent 5b8b85b475
commit 1dd14a9bbc
No known key found for this signature in database
GPG key ID: 017A11DC01A79831
2 changed files with 19 additions and 6 deletions

View file

@ -71,15 +71,15 @@ func New() AnyNsClientService {
func (s *service) doClient(ctx context.Context, fn func(cl nsp.DRPCAnynsClient) error) error { func (s *service) doClient(ctx context.Context, fn func(cl nsp.DRPCAnynsClient) error) error {
if len(s.nodeconf.NamingNodePeers()) == 0 { if len(s.nodeconf.NamingNodePeers()) == 0 {
log.Error("no namingNode peers configured") log.Error("no ns peers configured. Maybe you're on a custom network. Node config ID: " + s.nodeconf.Id())
return errors.New("no namingNode peers configured. Node config ID: " + s.nodeconf.Id()) return errors.New("no namingNode peers configured. Maybe you're on a custom network. Node config ID: " + s.nodeconf.Id())
} }
// it will try to connect to the Naming Node // it will try to connect to the Naming Node
// please enable "namingNode" type of node in the config (in the network.nodes array) // please enable "namingNode" type of node in the config (in the network.nodes array)
peer, err := s.pool.GetOneOf(ctx, s.nodeconf.NamingNodePeers()) peer, err := s.pool.GetOneOf(ctx, s.nodeconf.NamingNodePeers())
if err != nil { if err != nil {
log.Error("failed to get a namingnode peer. maybe you're on a custom network", zap.Error(err)) log.Error("failed to get a namingnode peer", zap.Error(err))
return err return err
} }

View file

@ -55,17 +55,30 @@ func New() AnyPpClientService {
return new(service) return new(service)
} }
/*
* Case 1: Custom network, no paymentProcessingNode peers ->
* This should not be called in custom networks! Please see what client of this service is doing.
* Otherwise will return: { "no payment processing peers configured. Maybe you're on a custom network" }
*
* Case 2: Anytype network, no paymentProcessingNode peers in config ->
* !!! This is a big issue, probably because of problems with nodeconf. Should be logged!
*
* Case 3: Anytype network, paymentProcessingNode peers in config, no connectivity ->
* This can happen due to network connectivity issues and it is OK.
* Will return:
* { "failed to get a paymentnode peer. maybe you're on a custom network","error":"unable to connect }
*/
func (s *service) doClient(ctx context.Context, fn func(cl pp.DRPCAnyPaymentProcessingClient) error) error { func (s *service) doClient(ctx context.Context, fn func(cl pp.DRPCAnyPaymentProcessingClient) error) error {
if len(s.nodeconf.PaymentProcessingNodePeers()) == 0 { if len(s.nodeconf.PaymentProcessingNodePeers()) == 0 {
log.Error("no payment processing peers configured") log.Error("no payment processing peers configured. Maybe you're on a custom network. Node config ID: " + s.nodeconf.Id())
return errors.New("no paymentProcessingNode peers configured. Node config ID: " + s.nodeconf.Id()) return errors.New("no paymentProcessingNode peers configured. Maybe you're on a custom network. Node config ID: " + s.nodeconf.Id())
} }
// it will try to connect to the Payment Node // it will try to connect to the Payment Node
// please use "paymentProcessingNode" type of node in the config (in the network.nodes array) // please use "paymentProcessingNode" type of node in the config (in the network.nodes array)
peer, err := s.pool.GetOneOf(ctx, s.nodeconf.PaymentProcessingNodePeers()) peer, err := s.pool.GetOneOf(ctx, s.nodeconf.PaymentProcessingNodePeers())
if err != nil { if err != nil {
log.Error("failed to get a paymentnode peer. maybe you're on a custom network", zap.Error(err)) log.Error("failed to get a paymentnode peer", zap.Error(err))
return err return err
} }