i add retry handler and retry error code in code, just like this
elastic.SetRetrier(newBadNetworkRetry()), elastic.SetRetryStatusCodes(503),
and my retrier is
func (b *BadNetworkRetry) Retry(ctx context.Context, retry int, req *http.Request, resp *http.Response, err error) (time.Duration, bool, error) { if retry >= 3 { return 0, false, errors.New(fmt.Sprintf("it had been retried 3 times, bad network: %v", err.Error())) } if err == io.EOF { return 0, true, nil } return 0, false, nil }
but there is not retry when es return io.EOF (it seems like break conn by es proactively ). just like
2024/02/19 07:30:00.260 [D] [value.go:586] [GetRecordCompleteTaskList] search record complete task list error: Post "https://elastic.tvunetworks.com:9200/recording-last-3-years/_search": EOF 2024/02/19 07:30:00.260 [E] [value.go:370] GetRecordingInfo failed, err: Post "https://elastic.tvunetworks.com:9200/recording-last-3-years/_search": EOF
i want to retry when es return io.EOF from es, how can i do that?
Please use the following questions as a guideline to help me answer your issue/question without further inquiry. Thank you.
Which version of Elastic are you using?
[√] elastic.v7 (for Elasticsearch 7.x) [ ] elastic.v6 (for Elasticsearch 6.x) [ ] elastic.v5 (for Elasticsearch 5.x) [ ] elastic.v3 (for Elasticsearch 2.x) [ ] elastic.v2 (for Elasticsearch 1.x)
Please describe the expected behavior
i add retry handler and retry error code in code, just like this
elastic.SetRetrier(newBadNetworkRetry()), elastic.SetRetryStatusCodes(503),
and my retrier is
func (b *BadNetworkRetry) Retry(ctx context.Context, retry int, req *http.Request, resp *http.Response, err error) (time.Duration, bool, error) { if retry >= 3 { return 0, false, errors.New(fmt.Sprintf("it had been retried 3 times, bad network: %v", err.Error())) } if err == io.EOF { return 0, true, nil } return 0, false, nil }
but there is not retry when es return io.EOF (it seems like break conn by es proactively ). just like
2024/02/19 07:30:00.260 [D] [value.go:586] [GetRecordCompleteTaskList] search record complete task list error: Post "https://elastic.tvunetworks.com:9200/recording-last-3-years/_search": EOF 2024/02/19 07:30:00.260 [E] [value.go:370] GetRecordingInfo failed, err: Post "https://elastic.tvunetworks.com:9200/recording-last-3-years/_search": EOF
i want to retry when es return io.EOF from es, how can i do that?