developit / developit/web-worker

worker starting further workers

Aperta
#12 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
1.2k
Fork
57
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I recently ran into a bad trap: I had another `require('web-worker')` in the code of the child and not only in the parent. This doesn't work, because the `workerThread` function is then executed again. The symptom is that messages are received twice in the worker.

This was hard to figure out. Note that this is not really a user's error, because a web worker is normally allowed to start another web worker. So it makes sense in general. (In my code, I could simply comment the bad `require` out, though.)

I guess that you need to split `node.js` into two files for this, because the main/worker dichotomy doesn't work anymore when workers can start workers.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by reading node.js and tracing how require('web-worker') invokes workerThread in both the parent and child. Reproduce the nested-worker case described in the issue and verify that messages are delivered once, then determine whether splitting node.js is sufficient to support workers starting further workers.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
web-dev
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.