Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Concurrent REST API calls

Avatar

Avatar
Validate 1
Level 2
ishanishah
Level 2

Likes

5 likes

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
ishanishah
Level 2

Likes

5 likes

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
ishanishah
Level 2

12-02-2019

We are using the ACS REST API to insert/update records on submission of a web form. The web form is a basic registration form with first name, last name, email address.

The API is able to insert/update records in the Profile table.

However, when there are simultaneous web form submissions, each web form having it's own API call, we expect only ONE record in the database. One of the API would insert and the other API would update the record.

However, we see 2 records inserted in the Profile table since the API is called at the same time

Does anyone know how this "race condition" is handled within REST API calls?

Do the ACS API calls run sequentially?

Do we need to add unique constraints in the DB to avoid double inserts? 

What is the best practice to avoid such conditions?

Thanks,

Ishani

Replies

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

25-02-2019

Hi Ishani,

Are you using a pre-loading inside the webapp?

Avatar

Avatar
Validate 1
Level 2
ishanishah
Level 2

Likes

5 likes

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
ishanishah
Level 2

Likes

5 likes

Total Posts

19 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
ishanishah
Level 2

25-02-2019

Hi Vipul,

The web apps are created by the client and are residing on their website . They're not pre-loading data.

They're using ACS REST API calls to insert/update data in Profile table.

Thanks,

Ishani