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

Bug: mongodb adapter was not stopped when broker stop #24

Open
zhaoyao91 opened this issue Apr 10, 2018 · 2 comments
Open

Bug: mongodb adapter was not stopped when broker stop #24

zhaoyao91 opened this issue Apr 10, 2018 · 2 comments

Comments

@zhaoyao91
Copy link

When I stop the broker, the mongodb adapter was not stopped correctly, so although the test run successfully, it doesn't exit. I have to add the workaround code to my service:

  async stopped() {
    await this.adapter.client.close(true)
  }
@icebob
Copy link
Member

icebob commented Apr 10, 2018

This close is called, but the Promise is not returned:

https://github.com/moleculerjs/moleculer-db/blob/master/packages/moleculer-db-adapter-mongo/src/index.js#L81

I think it is the problem, right?

@zhaoyao91
Copy link
Author

yeah, this is one reason. there is some tricky point for mongo client.close, you should pass true to it to force close, otherwise it will hang there.

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