itogami
itogami copied to clipboard
the speed is decreasing when using Bubletea with go func to triger out looping main in BubleTea tui Golang
func (b *Bubble) Init() tea.Cmd {
go func() {
pool := itogami.NewPoolWithFunc(uint64(b.Data.Thread), func(i uint32) {
b.mainScrapInit(b.Data.Weblist[i])
defer b.wg.Done()
})
for i := uint32(0); i < uint32(len(b.Data.Weblist)); i++ {
b.wg.Add(1)
pool.Invoke(i)
}
b.wg.Wait()
close(channelMsg)
}()
return tea.Batch(doneTick(), func() tea.Msg { return Channel{<-channelMsg, channelMsg} })
}