Skip to content

Commit

Permalink
Fixed root not passing itself
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsporn committed Feb 2, 2023
1 parent 5238c17 commit 807f642
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/workerpool/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"sync"

"github.com/iotaledger/hive.go/core/generics/lo"
"github.com/iotaledger/hive.go/core/generics/orderedmap"
"github.com/iotaledger/hive.go/core/syncutils"
)
Expand Down Expand Up @@ -100,7 +101,7 @@ func (g *Group) Pools() (pools map[string]*UnboundedWorkerPool) {
}

func (g *Group) CreateGroup(name string) (group *Group) {
group = newGroupWithRoot(name, g.root)
group = newGroupWithRoot(name, lo.Cond(g.root != nil, g.root, g))
group.PendingChildrenCounter.Subscribe(func(oldValue, newValue int) {
if oldValue == 0 {
g.PendingChildrenCounter.Increase()
Expand Down
2 changes: 1 addition & 1 deletion core/workerpool/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func Test(t *testing.T) {
group := NewGroup("protocol")
group := NewGroup(t.Name())
_ = group.CreatePool("poolA")

subgroup1 := group.CreateGroup("sub1")
Expand Down

0 comments on commit 807f642

Please sign in to comment.