Closed
Description
Motivation
I'd like to know when db connection goes down and gets up at application level. So, I can put my app in emergency mode. For example, if db connection is not available for 5 mins, I could close the app (process.exit
) or rely on app caches only and return some additional information for my API clients in response.
Proposed implementation
I propose to add 2 callback functions onconnected
and ondisconnected
(maybe there is a better way to express this through a single function, like connectionStateChanged
but then it will require to call this function when connection becomes idle, so not sure)