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

Restart server on failure when running Windows app #3985

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
jmorganca committed Apr 28, 2024
commit 08a792f2922e8b6f48b91e7b46d7152a264cd669
3 changes: 3 additions & 0 deletions app/lifecycle/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ func SpawnServer(ctx context.Context, command string) (chan int, error) {
slog.Info("starting server...")
cmd, err := start(ctx, command)
if err != nil {
crashCount++
slog.Error(fmt.Sprintf("failed to start server %s", err))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should continue the for loop so we don't crash on a nil pointer with cmd.Wait() below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great catch. Thank you!

time.Sleep(500 * time.Millisecond * time.Duration(crashCount))
continue
}

cmd.Wait() //nolint:errcheck
Expand Down