asynchronous函数vs child_process
我不知道在主进程中使用asynchronous函数( setInterval )还是在subprocess中运行它们之间的区别。
主stream程使用express框架来满足https请求的要求,asynchronous进程( 传入http和setInterval步骤)崩溃的可能性是多less?
这两个过程必须是可靠的并且以相对平行的方式运行。
我认为不同的是setInterval
设置一个计时器在同一个进程中运行。 虽然child_process
启动了一个新的进程。
https://nodejs.org/api/timers.html
https://nodejs.org/api/child_process.html
而且,subprocess不一定是asynchronous的。