On Mon, Jun 7, 2021 at 9:57 AM '[email protected]' via sequel-talk <
[email protected]> wrote:

> I've tried connection_validator plugin, but as jami said, if Heroku
> restarts db, all connections are invalid and
> "Sequel::DatabaseDisconnectError: PG::ConnectionBad: PQconsumeInput() SSL
> connection has been closed unexpectedly" raises...
>

Nothing is going to protect from cases where the database is restarted
while the connection is in use.  However, the connection validator should
handle cases where the connection is not checked out at the time the
database is restarted.  You can test this by running a local PostgreSQL
server, connecting to it with bin/sequel -E (which will use a logger), and
running:

DB.extension :connection_validator
DB.pool.connection_validation_timeout = -1
DB.get(1) # force a connection
# Run command externally to restart PostgreSQL
DB.get(2)

You will see that in the last DB.get(2) call, it tries the connection,
realizes it is bad, transparently creates a new connection, and uses that
to run the SELECT query and return the correct results. If you get
something different than that, please post details.

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/CADGZSSd4FRGpETQXoNbRJnn6WKs88wwsuYVeFK9V7qbiv8%3DrNQ%40mail.gmail.com.

Reply via email to