You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix false negative in PingController after Rails 7.2
Before Rails 7.2, ActiveRecord::Connection.connection.active? would fail
if it couldn't connect to the database and succeed if it could. This was
the basis for the check in the ping controller. In Rails 7.2 they now lazy
connect, so until something actual uses the connection, that will return
false.
This creates a false negative in the PingController the very first time
a connection is taken from the connection pool. Instead we can use our
connectable? override method, which actually tries to make a connection
before checking the connectivity.
Additionally, when there was an error in the PingController, it would go
through the standard error handler in the ApplicationController, which
would, in turn, return a jquery-rjs payload with the error back to the
client. However, this is not useful in the PingController as it's meant
to be used externally. This commit introduces custom error handling to
override the default handler.
0 commit comments