Loopback: datasource.discoverModelDefinitions keeps app running

Created on 8 Apr 2014  路  2Comments  路  Source: strongloop/loopback

Scaffold an LB application using slc lb project and configure a mysql datasource named db.

Run the following script:

var app = require('./app.js');
app.dataSources.db.discoverModelDefinitions(function(err, data) {
  console.log(Array.prototype.slice.call(arguments));
});

After the callback is called, the script continues to run. Probably the mysql connection pool is preventing the app from exit.

Expected behaviour: any background connections are unref-ed, so that the script ends.

bug

Most helpful comment

The dataSource has a disconnect() api which will shuts down the connection pool. Can you try?

All 2 comments

The dataSource has a disconnect() api which will shuts down the connection pool. Can you try?

The dataSource has a disconnect() api which will shuts down the connection pool. Can you try?

That works like a charm :+1:

Was this page helpful?
0 / 5 - 0 ratings