sosedoff / pgweb

Cross-platform client for PostgreSQL databases
https://sosedoff.github.io/pgweb
MIT License
8.63k stars 732 forks source link

Make idle connection timeout configurable #282

Closed sosedoff closed 6 years ago

sosedoff commented 7 years ago

Currently we have the inactive timeout value hardcoded in the code, see: https://github.com/sosedoff/pgweb/blob/b6167ce422ee26113222503df60932adc2736ba2/pkg/client/client.go#L369 This should be configurable using 2 new cli options:

BharatKalluri commented 7 years ago

Can I take this?

sosedoff commented 7 years ago

Go for it!

BharatKalluri commented 7 years ago

I am sorry, but I am not able to figure out how I should fix this. Any help?

sosedoff commented 7 years ago

If you still want to implement this feature, here's a few things to do:

ldinc commented 7 years ago

Is fixing client.IsIdle() func up to using with 2 new clli flags enough? Or i missunderstood session cleanup worker?

sosedoff commented 7 years ago

Yeah, 2 new flags should control how the cleanup worker terminates idle connection. If we have --disable-connection-idle-timeout set to false we should just turn off the worker here https://github.com/sosedoff/pgweb/blob/master/pkg/cli/cli.go#L201

ldinc commented 7 years ago

https://github.com/ldinc/pgweb/commit/3067b06bf6e8b7f0efd6849983bd4205ddb48915 Or better change timeout minutes from float64 to int?

sosedoff commented 6 years ago

This has been implemented via the following flags:

--no-idle-timeout  Disable connection idle timeout (false)
--idle-timeout=    Set connection idle timeout in minutes (180)