From 4e7ea32baf4553295ea0274c31795f2fd978622c Mon Sep 17 00:00:00 2001 From: Maxime Lagresle Date: Tue, 1 Oct 2024 09:10:37 +0200 Subject: [PATCH] log request retries --- internal/bitwarden/webapi/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/bitwarden/webapi/client.go b/internal/bitwarden/webapi/client.go index fde5c9f..6ed9ab6 100644 --- a/internal/bitwarden/webapi/client.go +++ b/internal/bitwarden/webapi/client.go @@ -78,10 +78,15 @@ func NewClient(serverURL string, opts ...Options) Client { o(c) } c.httpClient.Logger = nil - + c.httpClient.CheckRetry = CustomRetryPolicy return c } +func CustomRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) { + tflog.Trace(ctx, "retry_handler", map[string]interface{}{"status_code": resp.StatusCode, "status_message": resp.Status, "error": err}) + return retryablehttp.DefaultRetryPolicy(ctx, resp, err) +} + type client struct { deviceIdentifier string deviceName string