Skip to content

Commit 9c57c00

Browse files
authored
fix: add mutex to resource create because the api doesn't accept parallel requests in the edge application post #patch (#153)
1 parent fc6a520 commit 9c57c00

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/resource_edge_application_main_setting.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"io"
66
"strconv"
7+
"sync"
78
"time"
89

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

196+
var mutex sync.Mutex
197+
195198
func (r *edgeApplicationResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
196199
var plan EdgeApplicationResourceModel
197200
diags := req.Plan.Get(ctx, &plan)
198201
resp.Diagnostics.Append(diags...)
199202

203+
mutex.Lock()
204+
defer mutex.Unlock()
205+
200206
if plan.EdgeApplication.L2Caching.ValueBool() {
201207
resp.Diagnostics.AddError(
202208
"L2Caching error ",

0 commit comments

Comments
 (0)