1. Recursive invocation (and maximum call stack protection)
just added support for maxRecursion
in the machine runner. It’s a top-level property that lets you configure the built-in maximum call stack protection now included in the machine runner (defaults to 250.)
Only works for recursion invoked via env.thisMachine()
. For example:
var result = env.thisMachine({ stuff: inputs.i+1 }).execSync();
// ...
or
env.thisMachine({ stuff: inputs.i+1 }).exec({
error: exits.error,
success: function (result) {
// ...
}
});
If maxRecursion
is exceeded, instead of returning the real machine instance, env.thisMachine()
returns a decoy machine that always triggers its error exit with an Error instance (whose code property is “E_MAX_RECURSION”)
2. Auto-timeout
This version also includes support for timeout
, a top-level property configurable on a machine definition that indicates the max number of milliseconds to allow the machine to run before giving up and calling the error exit with an Error instance (.code === 'E_TIMEOUT'
). Defaults to 30000 (30 seconds).