diff --git a/core/service/servicegroup.go b/core/service/servicegroup.go index a71f8dd7..27ec45ad 100644 --- a/core/service/servicegroup.go +++ b/core/service/servicegroup.go @@ -68,7 +68,7 @@ func (sg *ServiceGroup) doStart() { for i := range sg.services { service := sg.services[i] - routineGroup.RunSafe(func() { + routineGroup.Run(func() { service.Start() }) } diff --git a/core/service/servicegroup_test.go b/core/service/servicegroup_test.go index e2957368..276d19c1 100644 --- a/core/service/servicegroup_test.go +++ b/core/service/servicegroup_test.go @@ -14,30 +14,6 @@ var ( done = make(chan struct{}) ) -type mockedService struct { - quit chan struct{} - multiplier int -} - -func newMockedService(multiplier int) *mockedService { - return &mockedService{ - quit: make(chan struct{}), - multiplier: multiplier, - } -} - -func (s *mockedService) Start() { - mutex.Lock() - number *= s.multiplier - mutex.Unlock() - done <- struct{}{} - <-s.quit -} - -func (s *mockedService) Stop() { - close(s.quit) -} - func TestServiceGroup(t *testing.T) { multipliers := []int{2, 3, 5, 7} want := 1 @@ -126,3 +102,27 @@ type mockedStarter struct { func (s mockedStarter) Start() { s.fn() } + +type mockedService struct { + quit chan struct{} + multiplier int +} + +func newMockedService(multiplier int) *mockedService { + return &mockedService{ + quit: make(chan struct{}), + multiplier: multiplier, + } +} + +func (s *mockedService) Start() { + mutex.Lock() + number *= s.multiplier + mutex.Unlock() + done <- struct{}{} + <-s.quit +} + +func (s *mockedService) Stop() { + close(s.quit) +}