Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sequelize.js: how to handle reconnection with MySQL

I've always used Mongo with Node, but now due to an existing datasource I need to connect a node app with Mysql.

Sequelize seems a good solution, but I don't get how to handle connection error, reconnection and re-tries.

To check for connection error on first run .authenticate().then().catch(function(error){...}); But what if I loose connection and want to reconnect?

like image 357
Luciano Avatar asked Feb 05 '16 11:02

Luciano


1 Answers

There is an open issue for this in Sequelize:

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

Based on that, this error is handled in sequelize.

like image 186
Gergo Avatar answered Sep 24 '22 16:09

Gergo