On Wednesday, April 15, 2020 at 2:52:23 PM UTC-7, BeeRich33 wrote:
>
> OK, I'm finding that disconnection times vary between < 1 second and 5 
> minutes.  
>
> disconnection: session time: 0:03:35.335 user=rich database=alpha 
> host=localhost port=51523
>
>
Does this output indicate that after you disconnect the connection (kill 
the socket), Sequel takes that long to handle the disconnection, or 
something else?  I'm not sure what this disconnect time represents.
 

> This is where it's confusing.  The pool is completely empty, and I should 
> be getting no PG errors, but I have (am testing this again).  You're saying 
> I *have to* apply *DB.pool.connection_validation_timeout = -1* in order 
> to review the pool first to see if there's any open connections first?  The 
> confusing bit is that if there are no valid connections, the request is 
> still there.  You've stated that the timeout set to -1 is how you always 
> review the pool and instantiate a new connection if there are no current 
> open connections to be used.  Why is that not the case all the time?  Is it 
> assumed there should be a current connection open?
>

I'm saying that if you choose a number above 0, the connection_validator 
extension will skip validation on checkout if the connection was checked in 
fewer than that many seconds ago.  If you want to validate on every 
checkout, regardless of the time since checkin, then you would use a number 
less than 0.  The connection_validator extension does not validate on every 
checkout by default as validation has a performance cost, and the more 
recently the connection was checked in, the less likely it is to be invalid.

In terms of how the connection pool in general works, if there is a request 
to checkout a connection (Database#synchronize), and there are no available 
connections, and the maximum number of connections has not been reached, 
then Sequel will create a new connection.  If the maximum number of 
connections has been reached, Sequel will wait for a connection to become 
available.  If no connections become available before the connection pool 
timeout, Sequel raises an exception.

If you think there is an issue here, please put together a minimal, self 
contained example similar to the one I posted earlier.  I can then review 
that to determine if there is a problem, and if so, hopefully how to fix it.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/d476d3fd-de02-40b2-9d50-ac224423847d%40googlegroups.com.

Reply via email to