andywer / andywer/threads.js

Question: how to handle long running processes?

未關閉
#317 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
question
主要語言
TypeScript
星號
3.5k
分支
173
PR 合併指標
30 天內沒有已合併 PR

描述

I'm just wondering what the recommended way is to tackle the following problem:

I have a long running external process (python) that waits for stdin and outputs on stdout. It doesn't restart every time because the overhead would be far longer than the execution time. I want to launch this process 16 times with `child_process.spawn`.

Now I'm not sure how I achieve this with Threads, because so far I've only used it with short running processes that exit when done.

I tried to create the process outside the scope in the file where my `expose` function is, but that ends up with all workers sharing the same child process globally.

Any suggestions?

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。