andywer / andywer/threads.js

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

Ouverte
#461 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
3.5k
Forks
173
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.