removed requirement for Show() method call
This commit is contained in:
parent
acfe7532d1
commit
5cb77ec486
10
view.go
10
view.go
@ -40,10 +40,7 @@ func NewForWriter[K comparable](w io.Writer) *View[K] {
|
||||
}
|
||||
|
||||
func (v *View[K]) Show() {
|
||||
go func() {
|
||||
defer close(v.reportCh)
|
||||
v.wg.Wait()
|
||||
}()
|
||||
go v.WaitForAllTasks()
|
||||
|
||||
for status := range v.reportCh {
|
||||
v.lastReports[status.ID] = status
|
||||
@ -83,5 +80,10 @@ func (v *View[K]) Done(task K) {
|
||||
}
|
||||
|
||||
func (v *View[K]) WaitForAllTasks() {
|
||||
go func() {
|
||||
defer close(v.reportCh)
|
||||
v.wg.Wait()
|
||||
}()
|
||||
|
||||
<-v.doneCh
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user