I'm using Umbraco 7.3.5 and I am doing some process heavy looping with approx 2.5k nodes.
Within each node, I'm setting a bunch of values to necessary properties for that specific node.
The process is taking quite some time when looping using a standard foreach - so I'd like to improve this as this scheduled task is going to run daily.
I came across the Parallel.ForEach (although not used it before) method and managed to dramatically improve the process speed. However, when I come to SaveAndPublish the node (inside the loop) - I get a null reference exception on this line:
I've noticed that during the first iteration, the node is successfully saved and published, but when I get to subsequent iterations, the null reference exception occurs.
What is strange is when I check the UmbracoContext at this point, it is not null!
Parallel.ForEach UmbracoContext is null
Hi,
I'm using Umbraco 7.3.5 and I am doing some process heavy looping with approx 2.5k nodes.
Within each node, I'm setting a bunch of values to necessary properties for that specific node.
The process is taking quite some time when looping using a standard foreach - so I'd like to improve this as this scheduled task is going to run daily.
I came across the Parallel.ForEach (although not used it before) method and managed to dramatically improve the process speed. However, when I come to SaveAndPublish the node (inside the loop) - I get a null reference exception on this line:
I've noticed that during the first iteration, the node is successfully saved and published, but when I get to subsequent iterations, the null reference exception occurs.
What is strange is when I check the UmbracoContext at this point, it is not null!
Please can anyone help with this?
Many thanks,
Rick
is working on a reply...