Recursive Schedule API Workflow - Help 🤯

Hey Bubblers,

The awesome yet mind boggling recursive workflows are kinda kicking my arse right now, and I would love some seasoned eyes to take a look at my approach and help me figure out where I am going wrong.

After reading all of the Schedule API Workflows Recursively threads I could find on the forum I created some, but the only way I could get them to work was to set the limiter on the individual actions (eg: Create a thing if the current value is greater than the most recent things value) and not on the Schedule Workflow action itself.

Background:
The aim is to create an automated workflow(s) where a thing is either updated or a new one created. There are currently 3 workflows in place. I am on the paid Personal plan.

Workflow 1:
Aim: Each ASSET’s price is updated every 30mins.
Thing: ASSET (This is an isolated list of things not linked to a specific user)
Event: New price is pulled from an API and the new price recorded in the DB every 30 minutes. When this happens the “Last Updated” field is updated with the current date/time.
Limiter: Do a search for Assets with “Last Updated” < Current date/time - 30mins
Recursive Schedule: Workflow scheduled for current/date+5seconds

Workflow 2:
Aim: Each USER’s investment value is updated every 60mins.
Thing: INVESTMENT (Belongs to a specific User in a 1-1 relationship). Each Investment is also linked to a specific ASSET)
Event: INVESTMENT’s value is Updated the latest price from the specific ASSET this INVESTMENT is linked to. Happens every 60mins. When this happens the “Last Updated” field is updated with the current date/time.
Limiter: Do a search for INVESTMENTS with “Last Updated” < Current date/time - 60mins
Recursive Schedule: Workflow scheduled for current/date+5seconds

Workflow 3:
Aim: Create a new datapoint for data visualisation in charts every 60mins (needs to happen after all investments have been updated.
Thing: CHART-DP
Event: Create a new CHART-DP with the total value of a USER’s list of INVESTMENT’s every 60 minutes. When this happens the “Last Updated” field is updated with the current date/time.
Limiter: None
Recursive Schedule: Workflow scheduled for current/date+60min

Example of recursive workflow:

As it stands I’ve created a “working” system but I’ve run into two main problems:

  1. The workflow is scheduling itself every 5 seconds and only actually doing anything when it finds a record that meets the limiter condition set, otherwise it’s just flying through with no actions actually being run. I had to do it this way as setting the limiter on the Schedule action itself meant if it it wasn’t successfully able to schedule the action, the workflow would stop and never start again. My concern here is that the current setup is SUPER inefficient, will burn through resources and not scalable for multiple users.

  2. The recursive scheduled workflows seems to randomly cancel themselves preventing anything being updated/created correctly in the database. I’ve not been able to find any information in the server logs to try and find out why it cancelled/didn’t reschedule.

I have been thinking that utilising a list per user for updates may be more elegant that what I’ve got, but I would love some input from the wizards here in the community.

I hope my ramblings above make sense, if not please ask and I’ll clarify whatever I need to :slight_smile:

Thanks so much in advance :pray:
Mike

Hey Mike!

With updates like these, you absolutely do run into the possibility of burning through your app’s resources. In fact, my suspicion for why you’re having workflows randomly cancel is that you’re hitting max capacity, things are being slowed down, and time out before they’re able to complete.

Would you mind shooting us an email at support@bubble.io so that our team could take a closer look at this and see how we can help?

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.