Sequelize: How to disconnect from DB?

Created on 15 Sep 2014  路  3Comments  路  Source: sequelize/sequelize

Hi! I'm being incredibly cheap and running a mysql+node project on heroku. The super cheap DB option has a hard limit of 10 connections to mysql. Heroku often "suspends" applications when they aren't in use, but that doesn't disconnect the sequelize client from mysql. I can catch the SIGTERM and call a disconnect when the app is "suspending", but how would I disconnect the client?

question

Most helpful comment

sequelize.close() is available on 2.0.0-dev13 and up i believe.

All 3 comments

sequelize.close() is available on 2.0.0-dev13 and up i believe.

Do however note that there is no equivalent reconnect method so you won't be able to use that particular instance again

Thanks for the info! My desire is to have a "clean" shutdown where all connections my app has open can be closed, and sequelize.close() is exactly what I need.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

couds picture couds  路  3Comments

mwain picture mwain  路  3Comments

Bondifrench picture Bondifrench  路  3Comments

mickhansen picture mickhansen  路  3Comments

mujz picture mujz  路  3Comments