Increase the max number of model listeners
See https://github.com/strongloop/loopback/issues/404
This commit is contained in:
parent
5221d12305
commit
8bc11ca51e
|
@ -161,6 +161,9 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett
|
||||||
};
|
};
|
||||||
// mix in EventEmitter (don't inherit from)
|
// mix in EventEmitter (don't inherit from)
|
||||||
var events = new EventEmitter();
|
var events = new EventEmitter();
|
||||||
|
// The model can have more than 10 listeners for lazy relationship setup
|
||||||
|
// See https://github.com/strongloop/loopback/issues/404
|
||||||
|
events.setMaxListeners(32);
|
||||||
for (var f in EventEmitter.prototype) {
|
for (var f in EventEmitter.prototype) {
|
||||||
if (typeof EventEmitter.prototype[f] === 'function') {
|
if (typeof EventEmitter.prototype[f] === 'function') {
|
||||||
ModelClass[f] = EventEmitter.prototype[f].bind(events);
|
ModelClass[f] = EventEmitter.prototype[f].bind(events);
|
||||||
|
|
Loading…
Reference in New Issue