Discussions
Avoiding a race condition (pause a Suitescript?
Hi,
We have a Suitescript in place which receives data via an HTTPS POST. This data s used to fulfill an existing sales order (if it hasn't been done already) and notify the customer of a purchase.
Problem: Each item purchased comes is via a separate HTTPS POST transaction. A single sales order can have many items. If we receive these transactions too close together, the second instance of the Suitescript fires before the first is finished. this results in one the the scripts throwing: RCRD_HAS_BEEN_CHANGED.
Each transaction comes with a unique ID. I'm thinking of getting the Suitescript to record this ID in a file while work is carried out and then null the contents of the file when its done. While one script is in progress, I want other instances to check the contents of this file every few seconds and wait until the content is null.