Skip to content

Commit 2c4492a

Browse files
authored
Update transport to latest version with resilient retry (elastic#385)
1 parent aacf60d commit 2c4492a

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

_benchmarks/benchmarks/cmd/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ import (
3131
"github.com/fatih/color"
3232
"github.com/montanaflynn/stats"
3333

34-
"github.com/elastic/go-elasticsearch/v8"
3534
"github.com/elastic/elastic-transport-go/v8/elastictransport"
35+
"github.com/elastic/go-elasticsearch/v8"
3636

3737
"github.com/elastic/go-elasticsearch/v8/benchmarks"
3838
"github.com/elastic/go-elasticsearch/v8/benchmarks/runner"
@@ -76,7 +76,7 @@ func main() {
7676
log.Printf(boldUnderline("Running benchmarks for go-elasticsearch@%s; %s/go%s"), elasticsearch.Version, runner.RuntimeOS, runner.RuntimeVersion)
7777

7878
var missingConfigs []string
79-
for k, _ := range benchmarks.Config {
79+
for k := range benchmarks.Config {
8080
v := os.Getenv(k)
8181
if v == "" {
8282
missingConfigs = append(missingConfigs, k)
@@ -120,9 +120,8 @@ func main() {
120120
}
121121

122122
reportClientConfig := elasticsearch.Config{
123-
Addresses: []string{benchmarks.Config["ELASTICSEARCH_REPORT_URL"]},
124-
MaxRetries: 10,
125-
EnableRetryOnTimeout: true,
123+
Addresses: []string{benchmarks.Config["ELASTICSEARCH_REPORT_URL"]},
124+
MaxRetries: 10,
126125
}
127126
if os.Getenv("DEBUG") != "" {
128127
runnerClientConfig.Logger = &elastictransport.ColorLogger{Output: os.Stdout}

_benchmarks/benchmarks/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.14
55
replace github.com/elastic/go-elasticsearch/v8 => ../../
66

77
require (
8+
github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c
89
github.com/elastic/go-elasticsearch/v8 v8.0.0-20200408073057-6f36a473b19f
910
github.com/fatih/color v1.7.0
1011
github.com/mattn/go-colorable v0.1.6 // indirect

elasticsearch.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ type Config struct {
7474
// The option is only valid when the transport is not specified, or when it's http.Transport.
7575
CACert []byte
7676

77-
RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504.
78-
DisableRetry bool // Default: false.
79-
EnableRetryOnTimeout bool // Default: false.
80-
MaxRetries int // Default: 3.
77+
RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504.
78+
DisableRetry bool // Default: false.
79+
MaxRetries int // Default: 3.
80+
RetryOnError func(*http.Request, error) bool // Optional function allowing to indicate which error should be retried. Default: nil.
8181

8282
CompressRequestBody bool // Default: false.
8383

@@ -188,11 +188,11 @@ func NewClient(cfg Config) (*Client, error) {
188188
Header: cfg.Header,
189189
CACert: cfg.CACert,
190190

191-
RetryOnStatus: cfg.RetryOnStatus,
192-
DisableRetry: cfg.DisableRetry,
193-
EnableRetryOnTimeout: cfg.EnableRetryOnTimeout,
194-
MaxRetries: cfg.MaxRetries,
195-
RetryBackoff: cfg.RetryBackoff,
191+
RetryOnStatus: cfg.RetryOnStatus,
192+
DisableRetry: cfg.DisableRetry,
193+
RetryOnError: cfg.RetryOnError,
194+
MaxRetries: cfg.MaxRetries,
195+
RetryBackoff: cfg.RetryBackoff,
196196

197197
CompressRequestBody: cfg.CompressRequestBody,
198198

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ module github.com/elastic/go-elasticsearch/v8
22

33
go 1.13
44

5-
require github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27
5+
require github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27 h1:O58SwZ7pdt7Lzy8JqpJubJlgDbr9jVV7ro4HFPvaZDw=
2-
github.com/elastic/elastic-transport-go/v8 v8.0.0-20211202110751-50105067ef27/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=
1+
github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c h1:onA2RpIyeCPvYAj1LFYiiMTrSpqVINWMfYFRS7lofJs=
2+
github.com/elastic/elastic-transport-go/v8 v8.0.0-20211216131617-bbee439d559c/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=

0 commit comments

Comments
 (0)