Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/module error #1175

Merged
merged 3 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/visor/visor.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ func NewVisor(ctx context.Context, conf *visorconfig.V1, restartCtx *restart.Con
// run Transport module in a non blocking mode
go tm.InitConcurrent(ctx)
mainModule.InitConcurrent(ctx)
if err := mainModule.Wait(ctx); err != nil {
select {
case <-ctx.Done():
if err := v.Close(); err != nil {
log.WithError(err).Error("Visor closed with error.")
}
default:
log.Error(err)
}
return nil, false
}
if err := tm.Wait(ctx); err != nil {
select {
case <-ctx.Done():
Expand Down
3 changes: 2 additions & 1 deletion pkg/visor/visorinit/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ func (m *Module) InitConcurrent(ctx context.Context) {
startSelf := time.Now()
// init the module itself
err := m.init(ctx, m.log)
m.log.Infof("Initialized in %s (%s with dependencies)", time.Since(startSelf), time.Since(start))
if err != nil {
m.err = fmt.Errorf("initializing module %s returning error: %v", m.Name, err)
return
}
m.log.Infof("Initialized in %s (%s with dependencies)", time.Since(startSelf), time.Since(start))
}