no more stack overflow from recursive sends

master
Marcus 2019-05-27 17:52:38 -04:00
parent 4b975d2af5
commit e24d7cf56e
1 changed files with 8 additions and 1 deletions

View File

@ -17,10 +17,17 @@ module.exports.Entity = class Entity {
} }
}); });
Object.defineProperty(this.instance, 'send', { Object.defineProperty(this.instance, 'send', {
value: systemPtr.send.bind(systemPtr) value: ((name, destination, options) => {
//anti call stack measure
setTimeout(_ => {
this.systemPtr.send(name, destination, options);
}, 0)
}).bind(that)
}); });
} }
start() { start() {
this.systemPtr.send('start', this.instanceData._id); this.systemPtr.send('start', this.instanceData._id);
} }