andywer / andywer/threads.js

Documentation: Init a worker with env vars

Offen
#353 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
documentation
Vorherrschende Sprache
TypeScript
Sterne
3.5k
Forks
173
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

I have a few env vars (RANDOM_SEED, THREADS) that I was setting in my pool init code and attempting to read in the workers. I realise now that I don't think that it is supported in node. I wonder if we could support starting the workers with some env vars set, similar to how spawn/exec allow setting env vars.

Something like:

```js
let pool = Pool(() => spawn(new Worker('./foo', {
env: {
RANDOM_SEED: 'kjhsdfjk',
THREADS: '8'
}
})));
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.