@@ -11,7 +11,7 @@ import (
1111
1212 "github.com/aws/aws-sdk-go-v2/service/s3"
1313 "github.com/aws/aws-sdk-go-v2/service/secretsmanager"
14- "github.com/hashicorp/go-retryablehttp "
14+ "github.com/p2p-b2b/httpretrier "
1515 "github.com/pkg/errors"
1616 "github.com/slashdevops/idp-scim-sync/internal/config"
1717 "github.com/slashdevops/idp-scim-sync/internal/core"
@@ -216,15 +216,11 @@ func SyncService(ctx context.Context, cfg *config.Config) (*core.SyncService, er
216216 gwsServiceAccountContent = gwsServiceAccount
217217 }
218218
219- idpClient := retryablehttp .NewClient ()
220- idpClient .RetryMax = 5
221- idpClient .RetryWaitMin = time .Millisecond * 200
222- // set the logger only in debug mode
223- if cfg .Debug {
224- idpClient .Logger = slog .Default ()
225- } else {
226- idpClient .Logger = nil
227- }
219+ idpClient := httpretrier .NewClient (
220+ 10 , // Max Retries
221+ httpretrier .ExponentialBackoff (10 * time .Millisecond , 500 * time .Millisecond ),
222+ nil , // Use http.DefaultTransport
223+ )
228224
229225 userAgent := fmt .Sprintf ("idp-scim-sync/%s" , version .Version )
230226
@@ -233,7 +229,7 @@ func SyncService(ctx context.Context, cfg *config.Config) (*core.SyncService, er
233229 ServiceAccount : gwsServiceAccountContent ,
234230 Scopes : cfg .GWSServiceAccountScopes ,
235231 UserAgent : userAgent ,
236- Client : idpClient . StandardClient () ,
232+ Client : idpClient ,
237233 }
238234
239235 // Google Client Service
@@ -257,18 +253,13 @@ func SyncService(ctx context.Context, cfg *config.Config) (*core.SyncService, er
257253 // AWS SCIM Service
258254
259255 // httpClient
260- scimClient := retryablehttp .NewClient ()
261- scimClient .RetryMax = 10
262- scimClient .RetryWaitMin = time .Millisecond * 100
263-
264- // set the logger only in debug mode
265- if cfg .Debug {
266- scimClient .Logger = slog .Default ()
267- } else {
268- scimClient .Logger = nil
269- }
256+ scimClient := httpretrier .NewClient (
257+ 10 , // Max Retries
258+ httpretrier .ExponentialBackoff (10 * time .Millisecond , 500 * time .Millisecond ),
259+ nil , // Use http.DefaultTransport
260+ )
270261
271- awsSCIM , err := aws .NewSCIMService (scimClient . StandardClient () , cfg .AWSSCIMEndpoint , cfg .AWSSCIMAccessToken )
262+ awsSCIM , err := aws .NewSCIMService (scimClient , cfg .AWSSCIMEndpoint , cfg .AWSSCIMAccessToken )
272263 if err != nil {
273264 return nil , errors .Wrap (err , "cannot create aws scim service" )
274265 }
0 commit comments