From 47bb52674a09f69bcb6f60f05976add9e2f39d4b Mon Sep 17 00:00:00 2001 From: kinggo Date: Fri, 21 Oct 2022 16:41:07 +0800 Subject: [PATCH] optimize: add SetRetryIf --- pkg/app/client/client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/app/client/client.go b/pkg/app/client/client.go index 37dc29baa..99d32a537 100644 --- a/pkg/app/client/client.go +++ b/pkg/app/client/client.go @@ -262,6 +262,14 @@ func (c *Client) SetRetryIfFunc(retryIf client.RetryIfFunc) { c.RetryIfFunc = retryIf } +// Deprecated: use SetRetryIfFunc instead of SetRetryIf +func (c *Client) SetRetryIf(fn func(request *protocol.Request) bool) { + f := func(req *protocol.Request, resp *protocol.Response, err error) bool { + return fn(req) + } + c.SetRetryIfFunc(f) +} + // SetProxy is used to set client proxy. // // Don't SetProxy twice for a client.