Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Refactoring wait group to analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Mar 16, 2021
1 parent 3f6980e commit a2bb588
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ func New(options *common.Options) {

con := options.Concurrency
swg := sizedwaitgroup.New(con)
for i := 0; i < con; i++ {
swg.Add()
go func() {
defer swg.Done()
go func() {
for log := range jobs {
swg.Add()
go func(line *gonx.Entry) {
defer swg.Done()

for log := range jobs {
threat, obj := teler.Analyze(options, log)
threat, obj := teler.Analyze(options, line)

if threat {
if metric {
Expand Down Expand Up @@ -105,9 +105,9 @@ func New(options *common.Options) {

alert.New(options, common.Version, obj)
}
}
}()
}
}(log)
}
}()

if options.Stdin {
input = os.Stdin
Expand Down

0 comments on commit a2bb588

Please sign in to comment.