Asynchronous vs synchronous actions

Hi all,
I am wanting to see if there is a list that exists of what actions are synchronous vs asynchronous. There are a few events that have pause actions in order to solve any synchronicity issues. I can’t image that having pause actions is good bubble practice as a pause of 500 ms on one system or one internet connection speed makes the workflow function as expected but then on a slower system and/or connection speed, it may not be enough.

Anything anyone can point me to as I know I’m going to run into problems in the future. Obviously I could make sure this never happens with 10 sec pauses but that is just terrible UX.

Any help would be much appreciated.

Most of the stuff in the bubble is synchronous but there is some event that is asynchronous. I don’t think there is such a list is available but you can share the particular use case, I can help you with that.

Thanks for your response. So I just tried to set up a very simple case of what I am experiencing but of course that worked and my much more complicated case doesn’t. I would have to play around a bunch (which I will get to) in order to make a relatively easily replicatable workflow. My guess is, without that, you’re not going to be able to help me but I’ll generally describe what is creating the issue:

Let’s say I have a db called fruit:
Action 1: Make changes to a fruit: first item. Thing to change: colour = green
Action 2: Show a group only when do a search for fruit (constraint colour = green): count >0

Basically the idea is that, action 2 theoretically won’t show the group if it tries to run before action 1 has finished.

This is the simple example I tried to set up, which works (I was hoping it didn’t for the purpose of this thread). My complicated workflow has a bunch of actions that show and hide groups, a lot of which have “only when” constraints which rely on an earlier action completing.

The other thing I’ll add is that within these complex workflows, there are stripe.js actions which could be part of the problem but I’m not sure they are given that there are actions to show groups that don’t show even though their criteria don’t rely on any of the stripe actions completing.

I’m sure you’re answer is going to be “sorry, I can’t really help you without a replicatable example”. I will try in the next couple of days to create one and post it back here but maybe you have some other thoughts.

Thanks for your help.

I usually end up relying on stage management

Instead of continuous workflows, I do use a workflow action that I’d want to be async and not add any actions after the one I want to ensure completes first. Then I use a do when true event bound to a state or other piece of data or watching for url parameters to update or any other event that would occur after the first action is completed. I run the test of the actions there.

3 Likes

Very interesting approach. I like that a lot. Thanks for this

If you do so-
In the workflow run Action 1 (i.e Make changes to fruit)

and on the group put the conditions show only when then both the action are independent. You don’t need to bother about the sync and async.

This is exactly what I’m running into. Creating a thing, then making a change to that thing while doing a search for something else with the thing in the constraint

A while back I reported what I thought was a bug, but which was actually related to this issue. The support person shared this with me, which has been helpful:

For efficiency purposes, workflows run in parallel across the server and the front end. Despite the names “Step 1”, “Step 2”, it is important to note that a given step does not necessarily wait for the previous one to complete before triggering the next one. The following is some information about Bubble workflow logic and general recommendations. Please also note that steps and actions are used interchangeably, but steps may be used in these examples when the order is important to note.

General rules about how workflows run:

  • Frontend workflow actions run in order but the next action does not wait on the previous action to be complete before triggering.

  • Backend workflows are triggered as soon as the workflow is triggered, independently from steps. For example, a ‘Schedule API Workflow’ action will be triggered as soon as the workflow is triggered even if it is placed last in the workflow action sequence.

  • Custom events run in sequence, not parallel. If Workflow 1 triggers a custom event that starts Workflow 2, Workflow 2 will complete before the remaining actions in Workflow 1 run.

  • Searches aren’t always immediately updated with new data. So if you create a new item, and then try to retrieve it via search, it may or may not work; you should not rely on this.

  • Retrieving a thing from “result of step X” where step X is the “Create…” step should always be safe.

Workarounds to help achieve workflow consistency:

  • When a workflow trigger (eg. a button) can have multiple results based on conditions, it is safer to create multiple workflows and place the conditions at the workflow level instead of creating one workflow with all possible actions and placing the conditions at the action level.
  • In a workflow with two actions, if Step 2 is using a condition based on a search depending on data manipulated in Step 1, then Step 1 should be implemented into a custom event to make sure it is finished before moving on to Step 2.
  • If a backend workflow should be triggered after other steps in the workflow, then it should be implemented in a custom event placed after the steps that need to come first.
  • The safest way to use data from one step to another is to use the “result of step X” operators instead of searches.
  • We do not offer the explicit ability for an action to wait for a workflow to be over before moving on to the next step; however, using ‘add a pause before next action’ action is usually an effective workaround.

Let me know if the above helps!

6 Likes

This is amazing. Thanks for posting. I really wish I knew this 3 months ago. Would have saved me a lot of time. I have pauses all over the place. I literally am just about to start rebuilding my cart and your post was perfect timing. Thanks so much

2 Likes