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(cloud): Ensure exit message is consistent #1906

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
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
20 changes: 17 additions & 3 deletions internal/cli/kraft/cloud/instance/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,27 @@ func Logs(ctx context.Context, opts *LogOptions, args ...string) error {

observations.Add(instance)

var inst *kcinstances.GetResponseItem
resp, err := opts.Client.Instances().WithMetro(opts.Metro).Get(ctx, instance)
if err != nil {
// Likely there was an issue performing the request; so we'll just
// skip and attempt to retrieve more logs.
if !errors.Is(err, io.EOF) {
log.G(ctx).Error(err)
}

continue
}

inst, err := resp.FirstOrErr()
if err != nil {
errGroup = append(errGroup, err)
}

// Continuously check the state in a separate thread every 1 second.
go func() {
for {
time.Sleep(time.Second)

resp, err := opts.Client.Instances().WithMetro(opts.Metro).Get(ctx, instance)
if err != nil {
// Likely there was an issue performing the request; so we'll just
Expand All @@ -174,8 +190,6 @@ func Logs(ctx context.Context, opts *LogOptions, args ...string) error {
if len(observations.Items()) == 0 {
return
}

time.Sleep(time.Second)
}
}()

Expand Down
Loading