andywer / andywer/threads.js

Documentation: Init a worker with env vars

Open
#353 2 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
TypeScript
Stars
3.5k
Forks
173
PR merge metrics
No merged PRs in 30d

Description

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'
}
})));
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.