Skip to content

Commit

Permalink
move the wait to outer loop
Browse files Browse the repository at this point in the history
WAN-3597 #time 10m
  • Loading branch information
shriyanshk128T committed Jan 8, 2025
1 parent ea906a1 commit d61a5db
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions plugins/inputs/t128_tank/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ parseLoop:
messages, parseErr = parseLines(tankReader, r.topic)
if parseErr != nil {
r.log.Errorf("encountered error while parsing lines in %s output, will not attempt to parse more lines: %v", r.topic, parseErr)
break parseLoop
return parseErr
}
var collectedMessages []IndexedMessage
for _, message := range messages {
Expand All @@ -284,14 +284,13 @@ parseLoop:
break parseLoop
case r.sendChan <- collectedMessages:
}

if cmdErr := cmd.Wait(); cmdErr != nil {
var exitErr *exec.ExitError
if errors.As(cmdErr, &exitErr) {
r.log.Errorf("%s tank read command exited with error: %s", r.topic, exitErr.Error())
} else {
r.log.Errorf("%s tank read command exited with error: %s", r.topic, cmdErr)
}
}
if cmdErr := cmd.Wait(); cmdErr != nil {
var exitErr *exec.ExitError
if errors.As(cmdErr, &exitErr) {
r.log.Errorf("%s tank read command exited with error: %s", r.topic, exitErr.Error())
} else {
r.log.Errorf("%s tank read command exited with error: %s", r.topic, cmdErr)
}
}

Expand Down

0 comments on commit d61a5db

Please sign in to comment.