(节点)警告:检测到可能的EventEmitter内存泄漏.11添加了退出侦听器。使用emitter.setMaxListeners()来增加限制

时间:2016-10-11 07:34:15

标签: node.js postgresql memory-leaks eventemitter

m fresh to node.js. I正在测试node.js项目。我遇到了一些问题。首先,我连接几个postgresql数据库,一切顺利。但是在添加了两个到postgrelSql数据库的新连接之后,这是我的连接代码:

var dbConfig = config.dbOrderV2;
exports.ORDERV2 = {};
exports.ORDERV2 = new Sequelize(dbConfig.dbname, dbConfig.username, dbConfig.password, {
  dialect: dbConfig.dialect,
  host: dbConfig.host,
  port: dbConfig.port,
  timezone: '+08:00',
  logging: undefined,
  pool: {
    maxConnections: dbConfig.pool
  }
});

var dbConfig = config.dbPay;
exports.PAY = {};
exports.PAY = new Sequelize(dbConfig.dbname, dbConfig.username, dbConfig.password, {
  dialect: dbConfig.dialect,
  host: dbConfig.host,
  port: dbConfig.port,
  timezone: '+08:00',
  logging: undefined,
  pool: {
    maxConnections: dbConfig.pool
  }
});

我启动项目,这是警告:

(node) warning: possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at process.addListener (events.js:239:17)
    at ConnectionManager (/Users/yangtao/Documents/code/zhike/data_import_export/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:45:11)
    at new ConnectionManager (/Users/yangtao/Documents/code/zhike/data_import_export/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:13:29)
    at new PostgresDialect (/Users/yangtao/Documents/code/zhike/data_import_export/node_modules/sequelize/lib/dialects/postgres/index.js:12:28)
    at new Sequelize (/Users/yangtao/Documents/code/zhike/data_import_export/node_modules/sequelize/lib/sequelize.js:213:18)
    at Object.<anonymous> (/Users/yangtao/Documents/code/zhike/data_import_export/src/common/dbs.js:185:19)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/yangtao/Documents/code/zhike/data_import_export/src/common/global.js:21:14)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/yangtao/Documents/code/zhike/data_import_export/dummyWorker.js:3:1)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)

有人可以帮我解决吗?感谢。

0 个答案:

没有答案