When using "On Start" code of a Function node in a subflow, the code is called multiple times. This is unexpected, at least by me. Is there any way to suppress/configure this?
Example output:
9 Mar 16:54:36 - [info] Started flows
9 Mar 16:54:36 - [info] [function:833ae1fa0bc8173e] On Start
9 Mar 16:54:36 - [info] [function:9bb3532e2df19fe8] On Start
Example flows.json:
[
{
"id": "719bc69b20978590",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "93c9faba1011712c",
"type": "subflow",
"name": "Subflow 1",
"info": "",
"in": [
{
"x": 60,
"y": 40,
"wires": [
{
"id": "15348321803f2de8"
}
]
}
],
"out": [
{
"x": 340,
"y": 40,
"wires": [
{
"id": "15348321803f2de8",
"port": 0
}
]
}
]
},
{
"id": "15348321803f2de8",
"type": "function",
"z": "93c9faba1011712c",
"name": "",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "// Code added here will be run once\n// whenever the node is started.\nnode.log('On Start');",
"finalize": "",
"libs": [],
"x": 200,
"y": 40,
"wires": [
[]
]
},
{
"id": "fa74d793acb7fb35",
"type": "inject",
"z": "719bc69b20978590",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 60,
"wires": [
[
"9747212c8784f910"
]
]
},
{
"id": "85f5417e36908743",
"type": "debug",
"z": "719bc69b20978590",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 370,
"y": 240,
"wires": []
},
{
"id": "9747212c8784f910",
"type": "subflow:93c9faba1011712c",
"z": "719bc69b20978590",
"name": "",
"x": 240,
"y": 120,
"wires": [
[
"cbbc22d504807358"
]
]
},
{
"id": "cbbc22d504807358",
"type": "subflow:93c9faba1011712c",
"z": "719bc69b20978590",
"name": "",
"x": 300,
"y": 180,
"wires": [
[
"85f5417e36908743"
]
]
}
]