From 10ec710f01d567e55b247fb853cfda644aef3445 Mon Sep 17 00:00:00 2001 From: crimson <1291463831@qq.com> Date: Mon, 20 Nov 2023 17:32:47 +0800 Subject: [PATCH 1/2] add retry timeout interface --- client.go | 5 +++++ client_interface.go | 2 ++ 2 files changed, 7 insertions(+) diff --git a/client.go b/client.go index 9cce645d..6fdaff93 100644 --- a/client.go +++ b/client.go @@ -165,6 +165,11 @@ func (c *Client) SetHTTPClient(client *http.Client) { c.HTTPClient = client } +// SetRetryTimeout set retry timeout +func (c *Client) SetRetryTimeout(timeout time.Duration) { + c.RetryTimeOut = timeout +} + // SetAuthVersion set signature version that the client used func (c *Client) SetAuthVersion(version AuthVersionType) { c.accessKeyLock.Lock() diff --git a/client_interface.go b/client_interface.go index ed5985d9..0dee411a 100644 --- a/client_interface.go +++ b/client_interface.go @@ -79,6 +79,8 @@ type ClientInterface interface { SetUserAgent(userAgent string) // SetHTTPClient set a custom http client, all request will send to sls by this client SetHTTPClient(client *http.Client) + // SetRetryTimeout set retry timeout, client will retry util retry timeout + SetRetryTimeout(timeout time.Duration) // #################### Client Operations ##################### // ResetAccessKeyToken reset client's access key token ResetAccessKeyToken(accessKeyID, accessKeySecret, securityToken string) From f5fd0c78cf81741686beb1496a491792749fefe7 Mon Sep 17 00:00:00 2001 From: crimson <1291463831@qq.com> Date: Mon, 20 Nov 2023 17:34:47 +0800 Subject: [PATCH 2/2] add token update client --- token_auto_update_client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/token_auto_update_client.go b/token_auto_update_client.go index d870d60b..184162ff 100644 --- a/token_auto_update_client.go +++ b/token_auto_update_client.go @@ -146,6 +146,11 @@ func (c *TokenAutoUpdateClient) SetHTTPClient(client *http.Client) { c.logClient.SetHTTPClient(client) } +// SetRetryTimeout set retry timeout +func (c *TokenAutoUpdateClient) SetRetryTimeout(timeout time.Duration) { + c.logClient.SetRetryTimeout(timeout) +} + // SetAuthVersion set auth version that the client used func (c *TokenAutoUpdateClient) SetAuthVersion(version AuthVersionType) { c.logClient.SetAuthVersion(version)