fix: don't delay messages behind a long command

This commit is contained in:
Raphael 'kena' Poss 2022-10-16 17:02:00 +02:00 committed by Christian Muehlhaeuser
parent 3609d87e70
commit cbe309d624
1 changed files with 4 additions and 1 deletions

5
tea.go
View File

@ -249,7 +249,10 @@ func (p *Program) handleCommands(cmds chan Cmd) chan struct{} {
// (e.g. tick commands that sleep for half a second). It's not // (e.g. tick commands that sleep for half a second). It's not
// possible to cancel them so we'll have to leak the goroutine // possible to cancel them so we'll have to leak the goroutine
// until Cmd returns. // until Cmd returns.
go p.Send(cmd()) go func() {
msg := cmd() // this can be long.
p.Send(msg)
}()
} }
} }
}() }()