Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func makeAbortChan(done chan struct{}) chan struct{} {
return abortChan
}

func runComponent(socket string, opts *componentsOpts, abortChan chan struct{}, onFinish *sync.WaitGroup) error {
func runComponent(socket string, opts *componentsOpts, abortChan chan struct{}) error {
// remove socket if it is already created.
if err := os.Remove(socket); err != nil && !os.IsNotExist(err) {
return err
Expand All @@ -80,7 +80,6 @@ func runComponent(socket string, opts *componentsOpts, abortChan chan struct{},
return err
}
go func() {
defer onFinish.Done()
<-abortChan
lis.Close()
}()
Expand Down Expand Up @@ -109,11 +108,12 @@ func Run() error {
socket := filepath.Join(socketFolder, component+".sock")
cleanupGroup.Add(1)
go func(opts *componentsOpts) {
err := runComponent(socket, opts, abort, &cleanupGroup)
err := runComponent(socket, opts, abort)
if err != nil {
svcLogger.Errorf("aborting due to an error %v", err)
done <- struct{}{}
}
cleanupGroup.Done()
}(factories[component])
}

Expand Down