I'm creating a new array from a global array and for a reason I cannot understand the global array gets updated on the same time as the new one, see example.
For info, I'm using ContextStorage to 'memory' as default and optionally to 'file', the circular issue occurs for both types of storage.
[
{
"id": "6dd670b22423b177",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "c18f55a1a1dc87e4",
"type": "inject",
"z": "6dd670b22423b177",
"name": "add 15 min",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "00 17 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 130,
"y": 220,
"wires": [
[
"73e3f0e04dd115c8"
]
]
},
{
"id": "73e3f0e04dd115c8",
"type": "function",
"z": "6dd670b22423b177",
"name": "+15 min",
"func": "var dd = global.get(\"ccc\");\ndd.minute = dd.minute + 15\n\nif (dd.minute > 59) {\n dd.minute = dd.minute - 60\n dd.hour = dd.hour + 1\n}\n\nflow.set(\"ddd\", dd, \"file\");\n\nreturn null;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 280,
"y": 220,
"wires": [
[]
]
},
{
"id": "68da3984b80c8313",
"type": "inject",
"z": "6dd670b22423b177",
"name": "set time",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "30 04 * * *",
"once": false,
"onceDelay": "0.5",
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 120,
"y": 180,
"wires": [
[
"d57ef3b9af0306be"
]
]
},
{
"id": "d57ef3b9af0306be",
"type": "function",
"z": "6dd670b22423b177",
"name": "Save times",
"func": "var cc = { minute: 0, hour: 19 };\nglobal.set(\"ccc\", cc);",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 180,
"wires": [
[]
]
}
]