A
A
Anubis2018-11-08 15:20:19
MySQL
Anubis, 2018-11-08 15:20:19

MySQL pool (via TypeORM): how to detect a possible shutdown of the database server?

Good day! I'm trying to figure out TypeORM, and in general, working with MySQL in a node.
TypeORM uses the normal mysql driver under the hood and creates a connection pool. I can't figure out how to detect possible database server disconnects in the future, after the initial connection is established.
At the moment, every second I "ping" the database with the "select 1" request, which returns an error if the database server is down. But I hope that there is a less "crutchy" way for the application to learn about changes in its state.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question