Skip to content

Unable to close and reopen same instance #7144

Closed

Description

@gsccheng

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.

Dialect: mariadb
Database version: 10.0.21
Sequelize version: 3.29.0

Activity

  1. sushantdhiman commented on Jan 25, 2017

    @sushantdhiman
    Contributor

    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

    But these methods will not prevent creating more connections, if your application demands them later on

  2. kresimir-franin commented on Aug 17, 2017

    @kresimir-franin

    @sushantdhiman How to reopen them? :)

    Got it

    ConnectionManager.prototype.initPools = function () {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions