andywer / andywer/threads.js

Tasks stuck and pool blocked

未关闭
#254 18 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
help wanted question
主要语言
TypeScript
星标
3.5k
派生
173
PR 合并指标
30 天内没有已合并 PR

描述

Hello, I'm having this weird behaviour where tasks are queued but the function itself is not running, and runningTasks just end up pilling up...
Keep in mind that I have not changed anything in my code..

```js
console.log('1')
this[pool].queue(async worker => {
console.log('2')
let m = worker[method]
console.log(m)
if (!m) return "Method doesn't exist";
console.log('3')
q = await m(item)
console.log('4')
return q;
})
console.log('5')
await this[pool].completed()
console.log('6')
return q;
```

and from the worker file:

```
const workerFunctions= {
async gen(c) {
console.log('FUNCTION RUNNING')
..................
}
...........
}
expose(workerFunctions)
```

Behaviour:
**1
2
[Function]
3
5**

The thing is, the exposed function is not being executed at all (**FUNCTION RUNNING** is never logged) and the pool just ends up having more and more runningTasks pilling up....

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。