Skip to content

Commit

Permalink
Favor starting viam-server first (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ale7714 authored Mar 12, 2024
1 parent 0b50eea commit 7def391
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/viam-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ func main() {
}
}

// Check for self-update and restart if needed.
needRestart, err := manager.SelfUpdate(ctx)
if err != nil {
globalLogger.Error(err)
}
if needRestart {
globalLogger.Info("updated self, exiting to await restart with new version")
return
// Start viam server as soon as possible. Then, start other subsystems and check for updates
if err := manager.StartSubsystem(ctx, viamserver.SubsysName); err != nil {
if errors.Is(err, agent.ErrSubsystemDisabled) {
globalLogger.Warn("viam-server subsystem disabled, please manually update /etc/viam.json and connect to internet")
} else {
globalLogger.Errorf("could not start viam-server subsystem: %s", err)
}
}

globalLogger.Debug("==== Starting background checks =====")
manager.StartBackgroundChecks(ctx)

<-ctx.Done()
Expand Down

0 comments on commit 7def391

Please sign in to comment.