Well, it finally happened… TL:Dr; Be careful with “Schedule API Workflow” and running a large list…
Some context: We have a basic ticket portal. It has around 10,000 tickets. I had to go update the description for these 10,000 tickets.
Now-a-days, we all know that “Schedule API Workflow” is the way to go to loop.
So, I took those 10,000 tickets, put it in a list in the Schedule API Workflow.. And for each ticket, update the description, then remove that ticket from the list.. Rinse and repeat.
Well, a powerful powerful lesson was learned… That 10,000 tickets I placed as a list was costing 200+ WU units EACH LOOP… Even though I was only “Make Change to” on 1 ticket each time.. Yikes.
So, here’s the best part… For Schedule API on a Workflow, it averts the Scheduler. Traditionally, if I had a run-away, I’d just go here.. And cancel.
No dice. The workflows were running quick - And didn’t hit the Scheduler..
So I had to hit Pause Tasks… Which finally shut it down.
So when the dust settled, I learned some powerful lessons.
- Be wary of passing in large lists to recursively run on.. even if you’re just doing one change to one item on a list at a time. That large list you pass into the API workflow apparently sucks a TON of Workflow Units every time you run that Schedule API Workflow.
- Schedule API Workflow on a List is no longer a black sheep to me.. Because atleast you can shut it down if it runs foul.
- Once the development credits run out, your production credits get hit. Thank GOODNESS I had “Disable Overages”.
- I restructured the loop.. I placed a database field for bSync.. Each loop didn’t pass in all of the tickets, instead, it did a fresh query for tickets that were bSync = no. I went from 200+ WU units per run… To ~2 WU. Same job.. Just different method.
At the end of the day, let’s be real.. It cost me $30. Does it suck? Yeah. But $30 is a pretty cheap lesson. And as much as I’m not a fan of the WU concept, I can’t complain because frankly, my software dev company I own’s payroll is $35k per month.. If an employee messes up, I’m out $200-$300. I do save money using Bubble compared to traditional development.
Hope y’all enjoyed and hope y’all have a better day than me!