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 摘要。