josdejong / josdejong/workerpool
Sharing complex objects across worker threads?
Open
- Dominant language
- JavaScript
- Stars
- 2.3k
- Forks
- 164
- PR merge metrics
- No merged PRs in 30d
Description
Is there a way to share DB pool object across the worker threads. Any attempts to send such object to the worker thread from the main thread via the pool.exec(...) call gives a DataCloneError since that object has a function reference. Also even though the worker threads are part of the same process ( i might be wrong here ) every time we "require" a module in the worker it gets a fresh copy instead getting a same copy from cache. This means we cannot use this module where DB connectivity is required.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.