Skip to content

Commit

Permalink
fix: add mutex to resource create because the api doesn't accept para…
Browse files Browse the repository at this point in the history
…llel requests in the edge application post #patch (#153)
  • Loading branch information
maxwelbm authored Aug 29, 2024
1 parent fc6a520 commit 9c57c00
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/resource_edge_application_main_setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"io"
"strconv"
"sync"
"time"

"github.com/aziontech/azionapi-go-sdk/edgeapplications"
Expand Down Expand Up @@ -192,11 +193,16 @@ func (r *edgeApplicationResource) Configure(_ context.Context, req resource.Conf
r.client = req.ProviderData.(*apiClient)
}

var mutex sync.Mutex

func (r *edgeApplicationResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var plan EdgeApplicationResourceModel
diags := req.Plan.Get(ctx, &plan)
resp.Diagnostics.Append(diags...)

mutex.Lock()
defer mutex.Unlock()

if plan.EdgeApplication.L2Caching.ValueBool() {
resp.Diagnostics.AddError(
"L2Caching error ",
Expand Down

0 comments on commit 9c57c00

Please sign in to comment.