Skip to content

Commit d8ee474

Browse files
committed
Revert "Stop the resource timer after last expected event"
This reverts commit a4ddbcb. Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 7d36164 commit d8ee474

File tree

10 files changed

+16
-52
lines changed

10 files changed

+16
-52
lines changed

pkg/compose/convergence.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ func (s *composeService) isServiceCompleted(ctx context.Context, containers Cont
757757
return false, 0, nil
758758
}
759759

760-
func (s *composeService) startService(ctx context.Context, project *types.Project, service types.ServiceConfig, containers Containers, wait bool) error {
760+
func (s *composeService) startService(ctx context.Context, project *types.Project, service types.ServiceConfig, containers Containers) error {
761761
if service.Deploy != nil && service.Deploy.Replicas != nil && *service.Deploy.Replicas == 0 {
762762
return nil
763763
}
@@ -785,28 +785,11 @@ func (s *composeService) startService(ctx context.Context, project *types.Projec
785785
if err != nil {
786786
return err
787787
}
788-
status := progress.Done
789-
if wait || dependencyWaiting(project, service.Name) {
790-
status = progress.Working
791-
}
792-
w.Event(progress.NewEvent(eventName, status, "Started"))
788+
w.Event(progress.StartedEvent(eventName))
793789
}
794790
return nil
795791
}
796792

797-
func dependencyWaiting(project *types.Project, name string) bool {
798-
for _, service := range project.Services {
799-
depends, ok := service.DependsOn[name]
800-
if !ok {
801-
continue
802-
}
803-
if depends.Condition == types.ServiceConditionHealthy {
804-
return true
805-
}
806-
}
807-
return false
808-
}
809-
810793
func mergeLabels(ls ...types.Labels) types.Labels {
811794
merged := types.Labels{}
812795
for _, l := range ls {

pkg/compose/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (s *composeService) start(ctx context.Context, projectName string, options
129129
return err
130130
}
131131

132-
return s.startService(ctx, project, service, containers, options.Wait)
132+
return s.startService(ctx, project, service, containers)
133133
})
134134
if err != nil {
135135
return err

pkg/compose/up.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ func (s *composeService) Up(ctx context.Context, project *types.Project, options
4343
return err
4444
}
4545
if options.Start.Attach == nil {
46-
w.HasMore(false)
4746
return s.start(ctx, project.Name, options.Start, nil)
4847
}
4948
return nil

pkg/progress/event.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,6 @@ func (e *Event) Spinner() any {
191191
case Error:
192192
return ErrorColor(spinnerError)
193193
default:
194-
return CountColor(e.spinner.String())
194+
return e.spinner.String()
195195
}
196196
}

pkg/progress/noop.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,3 @@ func (p *noopWriter) TailMsgf(_ string, _ ...interface{}) {
3838

3939
func (p *noopWriter) Stop() {
4040
}
41-
42-
func (p *noopWriter) HasMore(bool) {
43-
}

pkg/progress/plain.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,3 @@ func (p *plainWriter) TailMsgf(msg string, args ...interface{}) {
6464
func (p *plainWriter) Stop() {
6565
p.done <- true
6666
}
67-
68-
func (p *plainWriter) HasMore(bool) {
69-
}

pkg/progress/quiet.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,3 @@ func (q quiet) Events(_ []Event) {
3535

3636
func (q quiet) TailMsgf(_ string, _ ...interface{}) {
3737
}
38-
39-
func (q quiet) HasMore(bool) {
40-
}

pkg/progress/tty.go

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,17 @@ import (
3333
)
3434

3535
type ttyWriter struct {
36-
out io.Writer
37-
events map[string]Event
38-
eventIDs []string
39-
repeated bool
40-
numLines int
41-
done chan bool
42-
mtx *sync.Mutex
43-
tailEvents []string
44-
dryRun bool
45-
skipChildEvents bool
46-
progressTitle string
47-
hasFollowupAction bool
36+
out io.Writer
37+
events map[string]Event
38+
eventIDs []string
39+
repeated bool
40+
numLines int
41+
done chan bool
42+
mtx *sync.Mutex
43+
tailEvents []string
44+
dryRun bool
45+
skipChildEvents bool
46+
progressTitle string
4847
}
4948

5049
func (w *ttyWriter) Start(ctx context.Context) error {
@@ -71,10 +70,6 @@ func (w *ttyWriter) Stop() {
7170
w.done <- true
7271
}
7372

74-
func (w *ttyWriter) HasMore(b bool) {
75-
w.hasFollowupAction = b
76-
}
77-
7873
func (w *ttyWriter) Event(e Event) {
7974
w.mtx.Lock()
8075
defer w.mtx.Unlock()
@@ -87,9 +82,6 @@ func (w *ttyWriter) event(e Event) {
8782
}
8883
if _, ok := w.events[e.ID]; ok {
8984
last := w.events[e.ID]
90-
if e.Status == Done && w.hasFollowupAction {
91-
e.Status = Working
92-
}
9385
switch e.Status {
9486
case Done, Error, Warning:
9587
if last.endTime.IsZero() {

pkg/progress/tty_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestLineText(t *testing.T) {
4242
lineWidth := len(fmt.Sprintf("%s %s", ev.ID, ev.Text))
4343

4444
out := tty().lineText(ev, "", 50, lineWidth, false)
45-
assert.Equal(t, out, " \x1b[33m.\x1b[0m id Text Status \x1b[34m0.0s \x1b[0m\n")
45+
assert.Equal(t, out, " . id Text Status \x1b[34m0.0s \x1b[0m\n")
4646

4747
ev.Status = Done
4848
out = tty().lineText(ev, "", 50, lineWidth, false)

pkg/progress/writer.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ type Writer interface {
3636
Event(Event)
3737
Events([]Event)
3838
TailMsgf(string, ...interface{})
39-
HasMore(more bool)
4039
}
4140

4241
type writerKey struct{}

0 commit comments

Comments
 (0)