Fix: avoid forever loop
This commit is contained in:
5
bot.go
5
bot.go
@@ -684,8 +684,9 @@ out:
|
|||||||
toolResp.WriteString(toolChunk)
|
toolResp.WriteString(toolChunk)
|
||||||
tv.ScrollToEnd()
|
tv.ScrollToEnd()
|
||||||
case <-streamDone:
|
case <-streamDone:
|
||||||
// rrain any remaining chunks from chunkChan before exiting
|
// drain any remaining chunks from chunkChan before exiting
|
||||||
for chunk := range chunkChan {
|
for len(chunkChan) > 0 {
|
||||||
|
chunk := <-chunkChan
|
||||||
fmt.Fprint(tv, chunk)
|
fmt.Fprint(tv, chunk)
|
||||||
respText.WriteString(chunk)
|
respText.WriteString(chunk)
|
||||||
tv.ScrollToEnd()
|
tv.ScrollToEnd()
|
||||||
|
|||||||
Reference in New Issue
Block a user