The connection timer options idle_timeout, max_lifetime, and connect_timeout support any falsy values for nullable timeouts via the timer() helper:
|
if (!seconds) |
|
return { cancel: noop, start: noop } |
but the types are inconsistently declared as number or number | undefined then wrapped in Partial<> (effectively adding | undefined).
While it's true that using, e.g. connect_timeout: undefined would technically work with the current parseOptions use of k in o, it's potentially confusing with the defaulting logic when it's not present at all, so connect_timeout: 0 is currently the IMO best option to explicitly state you don't want a timeout, even if it's a bit weird looking.
It would be nice if other options like null or false were permitted, if this support is intentional? (Since this behavior isn't mentioned in the README that I could see)
Happy to PR if you think this is a good idea.
The connection timer options
idle_timeout,max_lifetime, andconnect_timeoutsupport any falsy values for nullable timeouts via thetimer()helper:postgres/src/connection.js
Lines 1044 to 1045 in e7dfa14
but the types are inconsistently declared as
numberornumber | undefinedthen wrapped inPartial<>(effectively adding| undefined).While it's true that using, e.g.
connect_timeout: undefinedwould technically work with the currentparseOptionsuse ofk in o, it's potentially confusing with the defaulting logic when it's not present at all, soconnect_timeout: 0is currently the IMO best option to explicitly state you don't want a timeout, even if it's a bit weird looking.It would be nice if other options like
nullorfalsewere permitted, if this support is intentional? (Since this behavior isn't mentioned in the README that I could see)Happy to PR if you think this is a good idea.