Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
firelizzard18 committed Jul 2, 2024
1 parent e65ff5b commit c199647
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/accumulated/run/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package run

import (
"log/slog"

"gitlab.com/accumulatenetwork/accumulate/exp/apiutil"
"gitlab.com/accumulatenetwork/accumulate/exp/ioc"
"gitlab.com/accumulatenetwork/accumulate/internal/api/routing"
Expand Down Expand Up @@ -56,7 +58,20 @@ func (r *RouterService) create(inst *Instance) (routing.Router, error) {
}
}

return apiutil.InitRouter(opts)
router, err := apiutil.InitRouter(opts)
if err != nil {
return nil, err
}

go func() {
if !<-router.(*routing.RouterInstance).Ready() {
// Failed to initialize router
slog.ErrorContext(inst.context, "Shutting down", "error", "failed to initialize router")
inst.shutdown()
}
}()

return router, nil
}

func (r *RouterService) start(inst *Instance) error {
Expand Down

0 comments on commit c199647

Please sign in to comment.