Hello,
I'm currently using Node Red to Create a complex application which involes many seperate Node-Lines in one Flow and the use of many Context Variables.
For that I have to understand how Node Red processes a Flow to be sure that my Data is consistent.
To get a better understanding what my problem is, I created a exapmle node which you can see in the Picture below:
In this Flow a Queue with different Tasks is stored as a Context-Variable. The Tasks are pushed in the Queue via POST Request. Every Second every Tasks in the Queue should be processed. After that every successful processed Task should be deleted.
To do this work I want to use as many Core Nodes as possible for easy understanding. Every time i want to change the queue I pull it from the Context variable, change it in the msg and then push the Data back to the context variable.
My problem now is that I don't know how my flow processes multiple "Lines". Is every Node-Line handled at one time or not?
So for example an POST Request is received and at the same time the Inject Node triggers. Will Node Red perform the first Line and then the other Line or will it perform both at the same Time and just switching between the Lines (Node 1 of Line 1, then Node 1 of Line 2, then Node 2 of Line 1, ...).
If it behaves like that my Data at the examle flow would not be consistent.
But for that I have a possible solution how to handle it but I'm also not sure if this works. My idea is to Create two Subflows. In each subflow it would pull the Data first and at the end it pushes the result back. But this only works if the subflow is being processed at ones and no other node in my flow does any work. Is this the case?
Can any one explain to me how this works in general?