Closed nikita-volkov closed 1 year ago
I was thinking that there might well be users who don't want any timeout. Then it's a pain to configure an arbitrarily high timeout to effectively disable it. It also makes the library a bit less convenient to use if you have to make that decision whenever you create a pool. At least using this in PostgREST I was happy to not have to make a decision for a default value and instead allow the user to specify a time and default to "off"...
(There's also the option of dropping the Maybe
and deactivating timeouts when the value is 0, but that feels a bit wrong. Or maybe of setting a sensible default, but I can't really think of any that makes sense.)
Do you expect most users to want to set a timeout?
Then it's a pain to configure an arbitrarily high timeout to effectively disable it.
Sure it's an extra place the user will have to think of. However it is something that he better think of either way IMO. When a user specifies say a year-long timeout, he is forced to think whether he really wants his app to stall waiting for a connection for a year. Likely not. With that said then having no timeout at all starts to look more questionable: is there any scenario at all where having the app stalled forever waiting for a connection is what the user wants?
Either way, I'm not super opinionated on the matter. I'm okay with keeping things as they are.
Just to chime in. We are using this library in production. We were recently debugging some concurrency issues and found ourselves saying, "we really should have put a timeout on this to rule out it getting stuck creating a connection".
Setting it to Nothing
let us defer deciding on a timeout, which may not have been the right call.
This is now enforced in the master branch.
I cannot imagine a case where it wouldn't make sense to have the timeout option specified. From that perspective there's no point in wrapping the value in
Maybe
.@robx What do you think?