mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 15:34:26 +01:00
@@ -403,6 +403,8 @@ module.exports = function(RED) {
|
||||
if(node.timeout>0){
|
||||
finOpt.timeout = node.timeout;
|
||||
finOpt.breakOnSigint = true;
|
||||
} else if (RED.settings.globalFunctionTimeout > 0){
|
||||
finOpt.timeout = RED.settings.globalFunctionTimeout * 1000
|
||||
}
|
||||
}
|
||||
var promise = Promise.resolve();
|
||||
@@ -419,8 +421,14 @@ module.exports = function(RED) {
|
||||
var opts = {};
|
||||
if (node.timeout>0){
|
||||
opts = node.timeoutOptions;
|
||||
} else if (RED.settings. globalFunctionTimeout > 0){
|
||||
opts.timeout = RED.settings. globalFunctionTimeout * 1000
|
||||
}
|
||||
try {
|
||||
node.script.runInContext(context,opts);
|
||||
} catch (err) {
|
||||
return done(err);
|
||||
}
|
||||
node.script.runInContext(context,opts);
|
||||
context.results.then(function(results) {
|
||||
sendResults(node,send,msg._msgid,results,false);
|
||||
if (handleNodeDoneCall) {
|
||||
|
||||
15
packages/node_modules/node-red/settings.js
vendored
15
packages/node_modules/node-red/settings.js
vendored
@@ -490,6 +490,7 @@ module.exports = {
|
||||
* - fileWorkingDirectory
|
||||
* - functionGlobalContext
|
||||
* - functionExternalModules
|
||||
* - globalFunctionTimeout
|
||||
* - functionTimeout
|
||||
* - nodeMessageBufferMaxLength
|
||||
* - ui (for use with Node-RED Dashboard)
|
||||
@@ -516,7 +517,19 @@ module.exports = {
|
||||
/** Allow the Function node to load additional npm modules directly */
|
||||
functionExternalModules: true,
|
||||
|
||||
/** Default timeout, in seconds, for the Function node. 0 means no timeout is applied */
|
||||
|
||||
/**
|
||||
* The default timeout (in seconds) for all Function nodes.
|
||||
* Individual nodes can set their own timeout value within their configuration.
|
||||
*/
|
||||
globalFunctionTimeout: 0,
|
||||
|
||||
/**
|
||||
* Default timeout, in seconds, for the Function node. 0 means no timeout is applied
|
||||
* This value is applied when the node is first added to the workspace - any changes
|
||||
* must then be made with the individual node configurations.
|
||||
* To set a global timeout value, use `globalFunctionTimeout`
|
||||
*/
|
||||
functionTimeout: 0,
|
||||
|
||||
/** The following property can be used to set predefined values in Global Context.
|
||||
|
||||
Reference in New Issue
Block a user