Sequelize.js: how to handle MySQL reconnection

I always used Mongo with Node, but now because of the existing data source I need to connect the node application with Mysql.

Sequelize seems like a good solution, but I don't understand how to handle a connection error, reconnection, and retry.

Checking for connection errors on first start .authenticate().then().catch(function(error){...}); But what if I lose my connection and want to connect again?

+4
source share
2 answers

Sequelize has an open problem:

https://github.com/sequelize/sequelize/issues/2113

Based on this, this error is processed in sequelize.

+2
source

, 4.11.1 of sequelize . , , , .
( .)

+1

Source: https://habr.com/ru/post/1627430/


All Articles