Skip to content

Commit

Permalink
address issue #136 again
Browse files Browse the repository at this point in the history
instead blocking renderReq, discard any output until
delayRC fires.
  • Loading branch information
vbauerster committed Dec 6, 2023
1 parent da3162c commit fdefae9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,19 +262,20 @@ func (p *Progress) Shutdown() {
func (p *Progress) serve(s *pState, cw *cwriter.Writer) {
defer p.pwg.Done()
var err error
var renderReq <-chan time.Time
w := cwriter.New(io.Discard)
renderReq := s.renderReq

for {
select {
case op := <-p.operateState:
op(s)
case fn := <-p.interceptIO:
fn(cw)
fn(w)
case <-s.delayRC:
renderReq = s.renderReq
w, cw = cw, nil
s.delayRC = nil
case <-renderReq:
err = s.render(cw)
err = s.render(w)
if err != nil {
go func() {
for {
Expand All @@ -293,7 +294,7 @@ func (p *Progress) serve(s *pState, cw *cwriter.Writer) {
for s.autoRefresh && err == nil {
s.hm.state(update)
if <-update {
err = s.render(cw)
err = s.render(w)
} else {
break
}
Expand Down

0 comments on commit fdefae9

Please sign in to comment.