Fix unstarted pointerdb responsibility (#1033)
This commit is contained in:
parent
8893884044
commit
e13f7c7a7d
@ -85,10 +85,10 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
errch <- satellite.Server.Run(satelliteCtx,
|
||||
grpcauth.NewAPIKeyInterceptor(),
|
||||
satellite.Kademlia,
|
||||
satellite.Audit,
|
||||
satellite.Overlay,
|
||||
satellite.Discovery,
|
||||
satellite.PointerDB,
|
||||
satellite.Audit,
|
||||
satellite.Checker,
|
||||
satellite.Repairer,
|
||||
satellite.BwAgreement,
|
||||
|
@ -25,7 +25,13 @@ type Config struct {
|
||||
// Initialize a tally struct
|
||||
func (c Config) initialize(ctx context.Context) (Tally, error) {
|
||||
pointerdb := pointerdb.LoadFromContext(ctx)
|
||||
if pointerdb == nil {
|
||||
return nil, Error.New("programmer error: pointerdb responsibility unstarted")
|
||||
}
|
||||
overlay := overlay.LoadServerFromContext(ctx)
|
||||
if overlay == nil {
|
||||
return nil, Error.New("programmer error: overlay responsibility unstarted")
|
||||
}
|
||||
db, ok := ctx.Value("masterdb").(interface {
|
||||
BandwidthAgreement() bwagreement.DB
|
||||
Accounting() accounting.DB
|
||||
|
@ -36,9 +36,10 @@ type Config struct {
|
||||
func (c Config) Run(ctx context.Context, server *provider.Provider) (err error) {
|
||||
identity := server.Identity()
|
||||
pointers := pointerdb.LoadFromContext(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
if pointers == nil {
|
||||
return Error.New("programmer error: pointerdb responsibility unstarted")
|
||||
}
|
||||
|
||||
overlay, err := overlay.NewClient(identity, c.SatelliteAddr)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -32,8 +32,14 @@ type Config struct {
|
||||
func (c Config) Run(ctx context.Context, server *provider.Provider) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
ol := overlay.LoadFromContext(ctx)
|
||||
overlay := overlay.LoadFromContext(ctx)
|
||||
if overlay == nil {
|
||||
return Error.New("programmer error: overlay responsibility unstarted")
|
||||
}
|
||||
kad := kademlia.LoadFromContext(ctx)
|
||||
if kad == nil {
|
||||
return Error.New("programmer error: kademlia responsibility unstarted")
|
||||
}
|
||||
stat, ok := ctx.Value("masterdb").(interface {
|
||||
StatDB() statdb.DB
|
||||
})
|
||||
@ -42,7 +48,7 @@ func (c Config) Run(ctx context.Context, server *provider.Provider) (err error)
|
||||
return Error.New("unable to get master db instance")
|
||||
}
|
||||
|
||||
discovery := NewDiscovery(zap.L().Named("discovery"), ol, kad, stat.StatDB())
|
||||
discovery := NewDiscovery(zap.L().Named("discovery"), overlay, kad, stat.StatDB())
|
||||
|
||||
zap.L().Debug("Starting discovery")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user