eggjs / egg

🥚 Born to build better enterprise frameworks and apps with Node.js & Koa
https://eggjs.org
MIT License
18.88k stars 1.81k forks source link

使用 piscina 实现不阻塞的 runInBackground #5359

Open fengmk2 opened 2 weeks ago

fengmk2 commented 2 weeks ago

请详细告知你的新解决思路(Your new RFCs):

https://github.com/piscinajs/piscina

目前的 runInBackground 是在 worker 进程或者 agent 进程执行的,如果是 cpu 密集型,那么还是会阻塞当前 worker 的处理速度下降。https://github.com/eggjs/egg/blob/ce4fd67278e008a0f58beff8db5c0f770f3eadc7/app/extend/context.js#L224

跟进类型(Follow-up Types):