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

[Model discovery] Need to force to exit when running lb4 discover command #2952

Closed
2 of 3 tasks
dhmlau opened this issue May 24, 2019 · 2 comments · Fixed by #3127
Closed
2 of 3 tasks

[Model discovery] Need to force to exit when running lb4 discover command #2952

dhmlau opened this issue May 24, 2019 · 2 comments · Fixed by #3127

Comments

@dhmlau
Copy link
Member

dhmlau commented May 24, 2019

Description / Steps to reproduce / Feature proposal

When running lb4 discover as below, the prompt never returns, and I need to press Ctrl+C to exit. The models are being created properly, but I need to kill the process in order to get the prompt back.

   $ lb4 discover --schema testdb
   ? Select the connector to discover ds
   ? Select the models which to discover address, customer
     create src/models/address.model.ts
     create src/models/customer.model.ts
     update src/models/index.ts
     update src/models/index.ts

   Discover address.model.ts,customer.model.ts was created in src/models/

Acceptance Criteria

  • Make sure to close all open datasource connections i.e. call datasource.disconnect()
  • Create/Update test(s) accordingly (try to capture/reproduce bug in tests)
  • Test against real live database (pick one SQL and NoSQL like MySQL/Mongo)

I'm using MySQL as the datasource, not sure if it matters.

@dhmlau
Copy link
Member Author

dhmlau commented May 24, 2019

cc @marvinirwin

@bajtos
Copy link
Member

bajtos commented May 24, 2019

I suspect the connector is keeping a pool of connections opened and these connections are blocking Node.js from exiting.

I think we should improve packages/cli/generators/discover/index.js to call await this.artifactInfo.dataSource.disconnect() after we have fetched all data from the database.

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

Successfully merging a pull request may close this issue.

3 participants