Way to Add API Workflows to a Que on a Thing

I think the best way to approach this is to explain what I’m trying to do, what the problem is., and then what i think a good solution (the idea) would be.

Task:
Although I try to avoid it, I have a page that requires I create multiple things at a time and add them to a single list. The best way to do this is to loop an API workflow on it self until it is complete then add the created things to the list only when all items are created.
(i have a ‘Created Things’ list which i add to when scheduling the next workflow. See below screen shot if this is not clear what I’m doing. this is my workflow to schedule the creation of the next thing)

The Problem:
The user is able to trigger the same workflow described above not long after the first one, which will then have bubble running two (or more!) workflows which will result in adding multiple lists to a single list in a small time frame

Bubble doesn’t handle this well & can result in data loss or some funky things happening with the list. Things get added then removed then added again, and its just buggy and untrust worthy.
I thought i read a post somewhere someone from the Bubble team says this a known issue but I may be wrong.

The Solution (or at least an idea):
Add Two new Workflow Actions.

Action #1 will be called: Check Workflow Que
And will only have one parameter which will be a Thing (can be anything)

When this Action runs - this will happen:
The Workflow will ask Bubble if there are any more API Workflows in that Thing’s Que.
If No > Continue the Workflow
If Yes > Terminate the Workflow & Add the API Workflow to the Que

Action #2 will be called: Run Next Workflow in Que
This will have two parameters
Thing (should be the same as the Thing in action #1)
Delay (to help spread out Workflows if desired)

As you may have guessed, this Action will fire the next API Workflow in the Que.

I feel this would be a not so complicated thing to add to Bubble but I won’t say I know that for sure.
All I do know is that my app would benefit in multiple areas if I could structure my workflows like this.
I have an idea for a large scale project and i dont feel comfortable with bubble specifically becuase it involves multiple users adding lists to lists constantly.

Really hope the Bubble team takes this one into consideration
If anyone has any similar work arounds to my issue then i’d also love to hear them! :innocent:

1 Like

Congratulations, you have invented Redis Message Queues :slight_smile:

(And IBM MQ if you are an old 'un).

So yeah, a common problem not just in Bubble.

You are right … Add a THING … update LIST with the THING has a habit of tripping over itself so you get less than the number of THINGs in the LIST than you wanted.

It was on the official to-do list “Workflow Consistency” but has now gone.

Workarounds …

  1. Do it “manually in the workflow” … so step by step.
  2. Do it far in advance. So create the new stuff in the background before the user gets to the page. Have it in “draft” status. Then they pick it up when you hit the page. This means orphan stuff but that is easily cleared up.

NG.

1 Like

Thanks for your response @NigelG. The workarounds you mentioned weren’t compatible with what I’m doing :frowning:
Reasons why:

  1. Step by step wouldn’t work for me because I wanted to loop the creation then add the list as the last action. This way i can complete the task on larger or smaller numbers without having to worry about workflow compatibility or creating complex workflows.

  2. I try to do that sort of thing as soon as possible and when i have all the info i need to create it, but it wont work here.
    What I’m doing is showing the users a prompt that holds things that will be added to their list. (this prompt appears multiple times in a short span)
    The problem is I’m not copying a list to another list. I’m taking one list (user picked) > Putting it in an RG with Text Inputs to alter the names/descriptions > taking those texts and creating a completely new Thing (for each cell) which is then added to a list.

.
.
Good News though! I did do (basically) what i outlined above using Vanilla Bubble.
(writing this part mainly for the future reader wanting to to the same thing)

-Here’s what to do

  • Create a New thing that will hold 2 attributes. (i called mine Creation Workflow)
    -Workflow Completed (y/n)
    -Parent Thing

  • Modify another Thing in your DB to hold a list of Creation Workflows.
    Call the attribute “Workflow Que”

  • Next, when ever you go to create your things or just want to Que up the workflow with your parameters you’re going to want to create the Creation Workflow and add it to the Workflow Que list

  • After your Creation Workflow is added. You’ll need to run an API workflow, which will trigger another if your Que is next in line and is ready.
    Workflows shown below:

Workflow A)
This one does not create or modify anything. Instead it asks bubble if the Creation Workflow its holding is next in Que. If yes, run Workflow B. If no, Schedule Workflow A for X Seconds from current time.

^^^^How do you do this?
Set a condition which will be:
When {Creation Workflow’s Parent Thing’s Creation Que’s:Filtered(Workflow Completed=No, Sorted by Creation Date) :FirstItem is this Creation Workflow}

Should look like this
image

Workflow B)
This one will perform what you need it to do and should only be ran from Workflow A.
But you must change the Creation Workflow’s Completed to Yes once it is all complete.

If this is at all unclear feel free to DM me and I’ll explain further.