Highlighted

Concurrent REST API calls

Avatar

Avatar

ishanishah

Avatar

ishanishah

ishanishah

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

Highlighted

Avatar

Avatar

Vapsy

Employee

Avatar

Vapsy

Employee

Vapsy
Employee

25-02-2019

Hi Ishani,

Are you using a pre-loading inside the webapp?

Highlighted

Avatar

Avatar

ishanishah

Avatar

ishanishah

ishanishah

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