poolboy icon indicating copy to clipboard operation
poolboy copied to clipboard

Support a maximum connection age

Open edevil opened this issue 7 years ago • 3 comments

I did not find this in the documentation, but it would be great if we could specify a maximum connection age so that connections are terminated and new ones are started after some time.

edevil avatar May 15 '17 11:05 edevil

One can achieve this by sending a message to self after X seconds. When this message arrives, :stop and the GenServer (considering you are using a GenServer) will terminate. Poolboy will start a new server. Would this solve your problem?

edgurgel avatar May 15 '17 20:05 edgurgel

This seems like it would solve my problem, but the pool object itself is being managed by ecto, I don't know if I'm able to even figure out the correct pids to send messages to.

edevil avatar May 19 '17 10:05 edevil

When the worker is starting, in the init function, it uses send_after to message self() after some max age.

If you can't do that because of ecto, what access does ecto give to you to configure poolboy?

Vagabond avatar May 19 '17 18:05 Vagabond