-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to recycle workers when heap limit is reached #56
Comments
Nice, Any example you got or a reproduction? |
This is a feature request. An example would be:
|
Ok, That's informative, thank you. |
@sheremet-va have you thought about what kind of API Tinypool would provide for this option? I'm just thinking that should there be a callback that is called when worker has finished the current task, and there user could do their own decisions whether a worker should be recycled or not. The API option would not mention heap or anything other as specific at all. |
What I thought was just an option like
Sure, it does sound useful for some other cases, where you want to control when it happens, but the callback would be called in the main thread. This is a bit inconvenient because we will have to tell the main thread some additional information before deciding if worker should be recycled, since the memory information is available only inside the worker (which can create race conditions). The solution with |
Right, and we cannot pass non-serializable data (functions) to workers. The |
To implement vitest-dev/vitest#3203 we need a way to terminate a worker and start a new one in its place when the worker reached its memory limit. It's already possible to pass down resource limits to workers (this is a native feature), but they will fail the pool instead of recycling the worker.
The text was updated successfully, but these errors were encountered: