SetImmediate — splitting heavy computing tasks. Do I understand correctly?

Hello!

Let's say there is a very big computational challenge and I want to split into parts and each part to perform in one iteration of the event loop of libUV, but not immediately. Let's say I broke it into 3 parts. Assume this:

function part1(){...}
function part2(){...}
function part3(){...}


The code is reading files, the server requests from users, etc

Is it right to break the doing so:
setImmidate(){

part1() //on the trail. iteration of the loop

setImmidate(){

 part2() //on the trail. iteration of the loop

setImmidate(){

 part3() //on the trail. iteration of the loop

}
}
}


In advance I Express my deep gratitude to all who help!
March 19th 20 at 08:41
0 answer

Find more questions by tags Node.js