Skip to content

Commit

Permalink
Correctly pass requests in After callback
Browse files Browse the repository at this point in the history
The BulkProcessor now correctly passes the requests to the After
callback.
  • Loading branch information
olivere committed Mar 3, 2016
1 parent 1b1e2ec commit ea60f14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions bulk_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,12 @@ func (w *bulkWorker) commit() error {
}
w.p.statsMu.Unlock()

// Save requests because they will be reset in commitFunc
reqs := w.service.requests

// Invoke before callback
if w.p.beforeFn != nil {
w.p.beforeFn(id, w.service.requests)
w.p.beforeFn(id, reqs)
}

// Commit bulk requests
Expand All @@ -473,7 +476,7 @@ func (w *bulkWorker) commit() error {

// Invoke after callback
if w.p.afterFn != nil {
w.p.afterFn(id, w.service.requests, res, err)
w.p.afterFn(id, reqs, res, err)
}

return err
Expand Down
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (

const (
// Version is the current version of Elastic.
Version = "3.0.23"
Version = "3.0.24"

// DefaultUrl is the default endpoint of Elasticsearch on the local machine.
// It is used e.g. when initializing a new Client without a specific URL.
Expand Down

0 comments on commit ea60f14

Please sign in to comment.