How can you avoid race conditions in a map reduce ...
# suitescript
a
How can you avoid race conditions in a map reduce script with multiple threads in which an action is carried out only once for each vendor, and then a checkbox is checked off preventing it from happening again? Perhaps an additional checkbox that only allows the function to be executed when it's unchecked and prevents other threads from executing the function until the said second checkbox is unchecked?
b
you can do a checkbox lock
you should simply be able to load the record, check that the processed checkbox isnt checked, then check and save the record
netsuite already enforces that native records can't be edited at the same time and will throw an error if 2 records try to save at the same time
that said, you may want to try grouping your inputs better (in getInputData) or from map to reduce
👍 1
a
thanks that makes complete sense...I think I have it figured out now!