Provide a way to get worker initialization error synchronously
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
What is the problem this feature will solve?
I'm using a worker to run asynchronous tasks and block the main thread with Atomics.wait().
If the worker has something like syntax errors, it seems that we can only get it by add a listener to error event, the program just hangs since worker can not wake the main thread.
new (require('worker_threads').Worker)(new URL('data:text/javascript,throw new Error'));
What is the feature you are proposing to solve the problem?
Provide a way to get the worker initialization error synchronously.
What alternatives have you considered?
I tried to pass a timeout to Atomics.wait(), but It's just a random magic number because I don't know how long the worker script takes to init.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con l’inizializzazione di worker_threads Worker e il comportamento di error-event, usando la data URL con un errore di sintassi come riproduzione. Verifica come Atomics.wait() interagisce con l’avvio del worker, quindi definisci e verifica come dovrebbe presentarsi un errore di inizializzazione sincrono senza affidarti a un timeout.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js
- Ambito
- backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100