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: Watch log hangs when we're in a terminal state #251

Merged
merged 1 commit into from
Aug 29, 2024
Merged
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
6 changes: 3 additions & 3 deletions internal/cmd/stack/run_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func runStates(ctx context.Context, stack, run string, sink chan<- string, acFn
fmt.Println("")

if transition.HasLogs {
if err := runStateLogs(ctx, stack, run, transition.State, transition.StateVersion, sink); err != nil {
if err := runStateLogs(ctx, stack, run, transition.State, transition.StateVersion, sink, transition.Terminal); err != nil {
return nil, err
}
}
Expand All @@ -153,7 +153,7 @@ func runStates(ctx context.Context, stack, run string, sink chan<- string, acFn
}
}

func runStateLogs(ctx context.Context, stack, run string, state structs.RunState, version int, sink chan<- string) error {
func runStateLogs(ctx context.Context, stack, run string, state structs.RunState, version int, sink chan<- string, stateTerminal bool) error {
var query struct {
Stack *struct {
Run *struct {
Expand Down Expand Up @@ -205,7 +205,7 @@ func runStateLogs(ctx context.Context, stack, run string, state structs.RunState
sink <- message.Body
}

if logs.Finished {
if logs.Finished || (!logs.HasMore && stateTerminal) {
break
}

Expand Down
Loading