Workflow Prioritization and Execution in WeWeb: Understanding Parallel Triggers and JavaScript Asynchronous Method

In this State Changers meeting, the participants discussed the workflow execution in WeWeb. They explored the order in which workflows trigger and the possibility of parallel execution. They indicated that workflows essentially trigger in a paired sequence, and if two "execute workflow" actions are run in succession, the first workflow will complete before the second begins - this process is referred to as 'awaiting the workflows'.


A key insight was the single-thread nature of JavaScript, which allows only one piece of code to run at a time. This seemingly simultaneous operation of codes is made possible by the async/await convention. The concept was explained using the metaphor of a train track: When a network request is made during asynchronous method execution, that operation ('train') is put on hold ('awaits'), freeing up the 'train track' for other functions ('trains') until the original request is completed. This way, multiple functions can be processed in a seemingly parallel manner. There was also a discussion around inconsistent triggers of two workflows related to user sessions and authentication token rotation upon page load. The recommended practice is not to have two independent workflows on page load running in parallel, but rather, have one workflow follow the other. This ensures the completion of the first requested operation before the second one triggers, reducing inconsistencies.


(Source: Office Hours 6/29 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free