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

search without retry when es return io.EOF #1684

Open
nilaonai opened this issue Feb 19, 2024 · 0 comments
Open

search without retry when es return io.EOF #1684

nilaonai opened this issue Feb 19, 2024 · 0 comments

Comments

@nilaonai
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant