Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate fault handling #2441

Merged
merged 3 commits into from
Sep 2, 2016
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ https://github.com/elastic/beats/compare/v5.0.0-alpha5...master[Check the HEAD d
==== Bugfixes

*Affecting all Beats*
- Fix logstash output handles error twice when asynchronous sending fails. {pull}2441[2441]
- Fix Elasticsearch structured error response parsing error. {issue}2229[2229]
- Fixed the run script to allow the overriding of the configuration file. {issue}2171[2171]
- Fix logstash output crash if no hosts are configured. {issue}2325[2325]
Expand Down
7 changes: 2 additions & 5 deletions libbeat/outputs/logstash/async.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func (c *asyncClient) AsyncPublishEvents(
cb: cb,
err: nil,
}
defer ref.dec()

for len(data) > 0 {
n, err := c.publishWindowed(ref, data)
Expand All @@ -115,15 +116,10 @@ func (c *asyncClient) AsyncPublishEvents(

data = data[n:]
if err != nil {
c.win.shrinkWindow()
_ = c.Close()

logp.Err("Failed to publish events caused by: %v", err)
eventsNotAcked.Add(int64(len(data)))
return err
}
}
ref.dec()

return nil
}
Expand Down Expand Up @@ -191,6 +187,7 @@ func (r *msgRef) dec() {
err := r.err
if err != nil {
eventsNotAcked.Add(int64(len(r.batch)))
logp.Err("Failed to publish events caused by: %v", err)
r.cb(r.batch, err)
} else {
r.cb(nil, nil)
Expand Down