fix: ensure registry is setup in construction
This commit is contained in:
parent
7578665ba4
commit
65727b8cc5
|
@ -52,7 +52,7 @@ func NewNode(config *config.NodeConfig) interfaces.Node {
|
|||
hashQueryRoutingTable: structs.NewMap(),
|
||||
httpClient: resty.New(),
|
||||
}
|
||||
n.services = NewServices(service.NewP2P(n))
|
||||
n.services = NewServices(service.NewP2P(n), service.NewRegistry(n))
|
||||
|
||||
return n
|
||||
}
|
||||
|
|
|
@ -23,8 +23,11 @@ func (s *ServicesImpl) Registry() interfaces.RegistryService {
|
|||
return s.registry
|
||||
}
|
||||
|
||||
func NewServices(p2p interfaces.P2PService) *ServicesImpl {
|
||||
return &ServicesImpl{p2p: p2p}
|
||||
func NewServices(p2p interfaces.P2PService, registry interfaces.RegistryService) interfaces.Services {
|
||||
return &ServicesImpl{
|
||||
p2p: p2p,
|
||||
registry: registry,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ServicesImpl) P2P() interfaces.P2PService {
|
||||
|
|
|
@ -44,10 +44,10 @@ func (r *RegistryImpl) Init() error {
|
|||
return utils.CreateBucket(registryBucketName, r.node.Db())
|
||||
}
|
||||
|
||||
func NewRegistry(node interfaces.Node, logger *zap.Logger) *RegistryImpl {
|
||||
func NewRegistry(node interfaces.Node) *RegistryImpl {
|
||||
return &RegistryImpl{
|
||||
node: node,
|
||||
logger: logger,
|
||||
logger: node.Logger(),
|
||||
streams: structs.NewMap(),
|
||||
subs: structs.NewMap(),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue