mirror of https://github.com/docker/compose.git
stop time.Ticker after use
Signed-off-by: Matthias Dötsch <matthias.doetsch@innogames.com>
This commit is contained in:
parent
693732c4a7
commit
7e6af46af0
|
@ -38,12 +38,13 @@ type ttyWriter struct {
|
|||
repeated bool
|
||||
numLines int
|
||||
done chan bool
|
||||
mtx *sync.RWMutex
|
||||
mtx *sync.Mutex
|
||||
tailEvents []string
|
||||
}
|
||||
|
||||
func (w *ttyWriter) Start(ctx context.Context) error {
|
||||
ticker := time.NewTicker(100 * time.Millisecond)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
|
@ -188,7 +189,7 @@ func lineText(event Event, pad string, terminalWidth, statusPadding int, color b
|
|||
padding = 0
|
||||
}
|
||||
// calculate the max length for the status text, on errors it
|
||||
// is 2-3 lines long and breaks the line formating
|
||||
// is 2-3 lines long and breaks the line formatting
|
||||
maxStatusLen := terminalWidth - textLen - statusPadding - 15
|
||||
status := event.StatusText
|
||||
// in some cases (debugging under VS Code), terminalWidth is set to zero by goterm.Width() ; ensuring we don't tweak strings with negative char index
|
||||
|
|
|
@ -78,7 +78,7 @@ func TestLineTextSingleEvent(t *testing.T) {
|
|||
func TestErrorEvent(t *testing.T) {
|
||||
w := &ttyWriter{
|
||||
events: map[string]Event{},
|
||||
mtx: &sync.RWMutex{},
|
||||
mtx: &sync.Mutex{},
|
||||
}
|
||||
e := Event{
|
||||
ID: "id",
|
||||
|
|
|
@ -105,7 +105,7 @@ func NewWriter(out console.File) (Writer, error) {
|
|||
events: map[string]Event{},
|
||||
repeated: false,
|
||||
done: make(chan bool),
|
||||
mtx: &sync.RWMutex{},
|
||||
mtx: &sync.Mutex{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue