Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas committed Jun 20, 2024
1 parent 1589102 commit a0e1f79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions internal/pkg/agent/appinit/appinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,21 @@ import (
)

var stopSvcChan = make(chan bool)
var once sync.Once
var stopBeat = func() {
close(stopSvcChan)
}

func init() {
var wg sync.WaitGroup
wg.Add(1)
go func() {
wg.Done()
service.ProcessWindowsControlEvents(stopBeat)
}()
wg.Wait()
once.Do(func() {
var wg sync.WaitGroup
wg.Add(1)
go func() {
wg.Done()
service.ProcessWindowsControlEvents(stopBeat)
}()
wg.Wait()
})
}

func StopSvcChan() chan bool {
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"time"

_ "github.com/elastic/elastic-agent/internal/pkg/agent/appinit"
"github.com/elastic/elastic-agent/internal/pkg/agent/cmd"
"github.com/elastic/elastic-agent/pkg/core/process"
)
Expand Down

0 comments on commit a0e1f79

Please sign in to comment.