Add timeout

This commit is contained in:
Ross Casey
2020-04-04 21:57:36 +01:00
parent 542ef7d506
commit 25734d09fe
3 changed files with 92 additions and 111 deletions

View File

@@ -209,7 +209,7 @@ module.exports = function(RED) {
try {
var start = process.hrtime();
sandbox.msg = msg;
const vm2Instance = new vm2.VM({ sandbox });
const vm2Instance = new vm2.VM({ sandbox, timeout: 5000 });
const result = vm2Instance.run(functionText);
sendResults(this,msg._msgid, result);