Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrateUp and migrateDown do not close their connections when finished #44

Open
jrnail23 opened this issue Jun 7, 2018 · 2 comments
Open

Comments

@jrnail23
Copy link

jrnail23 commented Jun 7, 2018

I'm using the migrate module directly (instead of the CLI) in jest test setups and teardowns (up on setup, down on teardown), and jest was hanging after the down migrations ran.
I noticed that migrateUp and migrateDown never close their connections after executing.
After adding the following finally blocks to each usage, jest stopped hanging, and its process was able to exit cleanly:

.finally(function () {
  return connection.close();
});

I'm pretty sure finally isn't supported everywhere yet, but the same can be accomplished via including the same in both a then and a catch. EDIT: actually, it's using the promises returned by rethink, which are bluebird promises (and thus, support finally).

@jrnail23
Copy link
Author

jrnail23 commented Jun 7, 2018

@vinicius0026: I saw your issue introducing rethinkdb-migrate after I posted this issue. I couldn't immediately tell whether yours suffers from this same issue, but it's probably worth checking! 😄

@vinicius0026
Copy link
Contributor

Hey @jrnail23, sure you can take a look at rethinkdb-migrate. Make sure to check our tests scripts, where we do just what you suggested here and close the connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants