From e24d7cf56e1c71ea404c5613e91062afc21aafeb Mon Sep 17 00:00:00 2001 From: Marcus Date: Mon, 27 May 2019 17:52:38 -0400 Subject: [PATCH] no more stack overflow from recursive sends --- core/entity.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/entity.js b/core/entity.js index 6da7c5b..041daec 100644 --- a/core/entity.js +++ b/core/entity.js @@ -17,10 +17,17 @@ module.exports.Entity = class Entity { } }); 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() { this.systemPtr.send('start', this.instanceData._id); }