Using AddDataRow in ParallelForEach

Is using AddDataRow in ParallelForEach safe? I have tested it with 300+ rows and it seems like no race condition occurs. I am wondering if there will be any problem.

I am using ParallelForEach to call an orchestrator API, and depending on the status code returned, I use AddDataRow to store successful API calls.

Thank you.

hi @Wen

Thanks
Latika

Thanks for the reply @Latika10011740,

I read through the thread, it discuss about using ParallelForEach to loop datatable. I am able to loop a DT but my question is about thread safety using AddDataRow in the Parallel body to add rows to another DT with scope outside the parallel body.

After reading some info online, this question is probably regarding .net instead of uipath. I have changed my AddDataTable activity to invoke method TryAdd on a ConcurrentDictionary object.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.