massivefermion / puddle

A resource pool manager for gleam
https://hex.pm/packages/puddle
5 stars 0 forks source link

Pool will leak processes if user process fails to check in worker #4

Open lpil opened 1 year ago

lpil commented 1 year ago

Currently if the user process fails to check back in the worker process that process is leaked.

Other pools tend to avoid this by providing a higher order function to remove the possibility of forgetting to check back in the worker (pool.transaction(fn() { do_work() })) and monitor user processes so that when they exit the workers can be added back to the pool.

Thanks, Louis

massivefermion commented 1 year ago

Thanks for the feedback I think the new version adequately addresses this

lpil commented 1 year ago

Could we also use monitors to detect when the user process exits without checking back in the worker process? That'll handle crashes gracefully then too.