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() {
|
func (v *View[K]) Show() {
|
||||||
go func() {
|
go v.WaitForAllTasks()
|
||||||
defer close(v.reportCh)
|
|
||||||
v.wg.Wait()
|
|
||||||
}()
|
|
||||||
|
|
||||||
for status := range v.reportCh {
|
for status := range v.reportCh {
|
||||||
v.lastReports[status.ID] = status
|
v.lastReports[status.ID] = status
|
||||||
@ -83,5 +80,10 @@ func (v *View[K]) Done(task K) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *View[K]) WaitForAllTasks() {
|
func (v *View[K]) WaitForAllTasks() {
|
||||||
|
go func() {
|
||||||
|
defer close(v.reportCh)
|
||||||
|
v.wg.Wait()
|
||||||
|
}()
|
||||||
|
|
||||||
<-v.doneCh
|
<-v.doneCh
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user