itogami icon indicating copy to clipboard operation
itogami copied to clipboard

the speed is decreasing when using Bubletea with go func to triger out looping main in BubleTea tui Golang

Open t101804 opened this issue 3 years ago • 0 comments

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} })
}

t101804 avatar Dec 31 '22 08:12 t101804