You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am doing some seeding and want to reopen a connection to MongoDB after closing it using on the instance (i.e. sequelize.close). However, I can't seem to be able to reestablish my connection and make any more calls, and instead keep getting a
Error: ConnectionManager.getConnection was called after the connection manager was closed!
I can provide more code later, but is there a good method to re-open a closed connection? Thanks.
Sequelize.close is used for closing pool, you should ideally call it when your application is shutting down or you want to close the pool.
I am afraid there is no method to restart pool effectively, If you are already using pool then you dont need to worry about closing connections, pool should handle that.
But if you want to just close all connections without closing pool, you can use these methods
Activity
sushantdhiman commentedon Jan 25, 2017
Sequelize.closeis used for closing pool, you should ideally call it when your application is shutting down or you want to close the pool.I am afraid there is no method to restart pool effectively, If you are already using pool then you dont need to worry about closing connections, pool should handle that.
But if you want to just close all connections without closing pool, you can use these methods
v4-0-02)But these methods will not prevent creating more connections, if your application demands them later on
kresimir-franin commentedon Aug 17, 2017
@sushantdhiman How to reopen them? :)
Got it
sequelize/lib/dialects/abstract/connection-manager.js
Line 86 in cb6c493