Skip to content

Commit

Permalink
Merge pull request #425 from philips-software/chore/424
Browse files Browse the repository at this point in the history
Add missing retry logic. Refs #424
  • Loading branch information
loafoe authored Jul 26, 2024
2 parents 503fefe + d4c1ef4 commit 0d60dfe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/services/function/resource_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/cenkalti/backoff/v4"

"github.com/distribution/reference"
"github.com/distribution/reference"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -180,7 +180,13 @@ func resourceFunctionUpdate(_ context.Context, d *schema.ResourceData, m interfa
return diags
}
code.Image = d.Get("docker_image").(string)
_, resp, err := ironClient.Codes.CreateOrUpdateCode(*code)
var resp *iron.Response
operation := func() error {
_, resp, err = ironClient.Codes.CreateOrUpdateCode(*code)
return err
}
err = backoff.Retry(operation, backoff.WithMaxRetries(backoff.NewExponentialBackOff(), 8))

if err != nil {
return diag.FromErr(fmt.Errorf("CreateOrUpdateCode(%v): %w", code, err))
}
Expand Down

0 comments on commit 0d60dfe

Please sign in to comment.