Skip to content

Commit

Permalink
Fix ws start status logging
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptronicek committed Nov 7, 2023
1 parent 2662c48 commit d0fc9e5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions components/local-app/pkg/helper/workspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ func ObserveWorkspaceUntilStarted(ctx context.Context, clnt *client.Gitpod, work
return ws.Status, nil
}

var wsStatus string
slog.Info("waiting for workspace to start...", "workspaceID", workspaceID)
if HasInstanceStatus(wsInfo.Msg.Result) {
slog.Info("workspace " + prettyprint.FormatWorkspacePhase(wsInfo.Msg.Result.Status.Instance.Status.Phase))
slog.Info("workspace status: " + prettyprint.FormatWorkspacePhase(wsInfo.Msg.Result.Status.Instance.Status.Phase))
wsStatus = prettyprint.FormatWorkspacePhase(wsInfo.Msg.Result.Status.Instance.Status.Phase)
}

var (
Expand All @@ -186,7 +188,6 @@ func ObserveWorkspaceUntilStarted(ctx context.Context, clnt *client.Gitpod, work
continue
}

previousStatus := ""
for stream.Receive() {
msg := stream.Msg()
if msg == nil {
Expand All @@ -200,13 +201,13 @@ func ObserveWorkspaceUntilStarted(ctx context.Context, clnt *client.Gitpod, work
return ws, nil
}

var currentStatus string
if HasInstanceStatus(wsInfo.Msg.Result) {
currentStatus = prettyprint.FormatWorkspacePhase(wsInfo.Msg.Result.Status.Instance.Status.Phase)
}
if currentStatus != previousStatus {
slog.Info("workspace " + currentStatus)
previousStatus = currentStatus
newWsStatus := prettyprint.FormatWorkspacePhase(ws.Instance.Status.Phase)
// De-duplicate status messages
if wsStatus != newWsStatus {
slog.Info("workspace status: " + newWsStatus)
wsStatus = newWsStatus
}
}
}
if err := stream.Err(); err != nil {
Expand Down

0 comments on commit d0fc9e5

Please sign in to comment.