andywer / andywer/threads.js

pool.terminate hangs when "Timeout: Did not receive an init message from worker" first

Đang mở
#461 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
3.5k
Fork
173
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I have some code like:

```
let err;
try {
await pool.settled();
} catch (_err) {
err = _err;
} finally {
await pool.terminate(!!err);
}
```

It works when there are no errors, and when there is an "expected" error in one of the threads, but when the error is "Timeout: Did not receive an init message from worker ...", calling terminate hangs. I have the workaround:

```
if (!err?.message?.startsWith('Timeout: Did not receive an init message from worker')) {
await pool.terminate(!!err);
}
```

which works, but it seems like an early exit inside terminate would be appropriate for a case like this. Thoughts?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.