I’ve been dealing with this bug and Bubble support can’t seem to figure it out. Basically the problem is that even when this workflow runs properly and all conditions are met, the data that is supposed to be added on the last step just isn’t getting into the database. Bubble support seems to think it’s a race condition, but even when I set what I thought was a reasonable interval (1 second), it still glitches.
I’ll try to show you guys and keep it as simple as possible, I know it’s annoying to try and understand someone else’s workflow. Basically I have a list of geographic work areas, and the workflow checks whether a specific address is in the list or not. If it’s in the list, the work area is added to the database.
Step 1 (this draws the list of Work Areas and hospitals whose address I’m checking):
Step 2.1 (this is running a plugin action where now each hospital address is being checked to see if it is contained within each Work Area. Will return a yes or no)
The problem is, even when I look through the logs and see that 2.1 return a Yes, the Work Area was not added! It’s random. Adding the 1 second interval helped, I thought, but I noticed the bug again today so now I changed it to 3 seconds. It runs very slow now unfortunately. What am I doing wrong?
Another kink in your workflow is that they won’t run at the same speed. The first workflow will take a while to get going because of the plug-in SSA warmup time, meaning the 1st/2nd/3rd BE workflow step 2s may run at essentially the same time.
Not much you can do I’m afraid, except possibly create a new data type which links the User and Vet list and then Do a search for list rather than reference Current User’s List of X.
That’s a bummer, because as I get more users this problem is going to become more and more apparent!
Too bad you can’t put a pause in backend workflows, I was thinking that between step 2.1 and 2.2 if I could pause the workflow for a second on a Yes condition, that would give the database time.
yes, adding data to a list multiple times in parallel is subject to race conditions. there are mentions of this problem on old topics around the forum.
When you schedule a workflow on a list you don’t control the execution time, so the data modified by every run needs to be exclusive and not shared with another run. In a case when you need to add multiple things to the same list you shoud try a recursive workflow where each result is passed as a list of results in an input of the workflow and on the last iterarion set the list.
alternatively, if the list to check is not big enough to cause a timeout, you can modify the plugin to check the whole list in one pass and resolve the whole logic in a single workflow.
Can you help me figure out how I would change it in this case? Because I’m processing two lists, one list of Work Areas against a list of individual addresses (hospitals)
Clunky but create a thing in the workflow, and on the last iteration, set the list to Do a search for Things (the things you created in the workflow). This means you only set list once, right at the end. You can delete the things you created after setting the list.
the list that you are currently using for the schedule wf on a list (let’s call it listA)
an index (use 1 on the first schedule)
a list of things of the type you want to add. make it optional, it will keep the result of the previous iterations (let’s call it listB)
add a condition on the wf to run only if index is minor or equal listA count
in the wf call the action that returns yes or no, you can access the current iteration thing with listA item# index, then:
if the index is minor or equal to listA count and the prev action’s result is yes schedule the same workflow with same listA, index +1, listB plus item current iteration’s thing
if the index is minor or equal to listA count and the prev action’s result is no schedule the same workflow with same listA, index +1, same listB
if the index is more than listA count set the value of the list to listB
!!!WARNING!!!
it is very easy to create an infinite recursion if not setting the conditions properly. at the very least set infinite recursion protection
it’s probably a better idea to modify the plugin that checks the value returning yes/no to check the whole list in one go and return a list of things, so that you can after set the list with a single wf.
Some useful info going on in this thread! here’s an alternative way that I think will work…
Instead of giving the action a single pair of latitude and longitude values, are you able to provide it with the whole list of “hosp’s” and make use of the list of unique ID’s field? You need to be sure all three lists are the same (and sorted the same) with only the field names changing for each option.
If you do that, when the action completes, it will return the following:
a list of ‘found latitudes’
a list of ‘found longitudes’
a list of ‘unique ids’
I think in your case, you only really need to use the list of unique ids. If you then use the action “Make changes to a list of things” and set it up like:
Can you clarify how to use the “List of unique ID’s field”? I set it up like this - when that field is empty I can get the google map function to work, but when I fill it I get this error:
And if you run it step-by-step just before the action runs (assuming it’s being triggered client-side first), then you can clearly see this information as shown below…
Actually i can see it’s being triggered from within another backend API. Can you create a test button, throw it on the page then run the same action, debug it and see if it works. I’ll test it through the backend also. It’s looking to me like a data issue of some kind. I can help you go through this to debug over a video call if you want, just PM me.
Same error when trying it with the front end. I think the issue is that my address data is a field on the User, and not its own data type? So when I feed it the unique ID, it is the unique ID of the user and not the address. Seems like that’s what’s google is having a problem with, it’s getting user data
I made my plugin wait please to add server side pauses for this reason. It’s a simple setTimeout as a node server side action. You can make this yourself too pretty easily but if you’re too lazy I’m selling mine for 15$.
Though I suppose that fixes half of my problem, when I want to check one Work Area against multiple Hospital Addresses. I also get a race condition when I check one Hospital Address against multiple Work Areas. Is there a way to run a list of polygon coordinates against a single point coordinate?
Maybe not a solution in your case but we use custom workflow with return data as much as possible. Triggering several custom workflows in a wf will mean that they will be executed in the order they are placed.