So I have a custom api call that doesn’t actually return data but it loops over lots of data in my Xano Database to update it and then just return “Success” back. I don’t want users to seeing a long progress bar for a few minutes and I need to do this on click of a button. Should I move it to a backend workflow? If yes, is it gonna consume lots of workload units? After all, the processing and updating is happening on Xano and the api call is merely just waiting for a response back which might take a few minutes depending on the size of my growing database.
Yes that would work better.
The processing is done on Xano but you never know with bubble WUs.
The WU conumption chart has the following line item:
I was worried that waiting for an API response might count towards the execution time. However I ran some tests and it seems that it does not It would be quite ridiculous if Bubble charged for await time, but you never know. You should probable run a quick test on your end too.
Keep in mind that API calls on bubble’s APi connector time out after 300 seconds.
If you think that your Xano processing time could exceed that, consider splitting the API into an API call from Bubble to Xano that starts the processing, and webhook API from Xano to bubble that just returns whether the process was successful or not.
Thanks a lot for this! It is indeed a relieve to know that await time does not cost us workload units haha. And I believe I don’t need to setup the webhook at all as I kind of don’t need a response back. The api just tells xano to perform a task and that’s it. I don’t have to report back to my app if the task was completed or not as I’m pretty sure it completes all the time!
Thanks for the help!
Regardless of whether you need a response back or not, the API connector expects a response back. It expects a 2xx response code at the very least.
And you can never be so sure, errors happen in all kinds of ways. It’s important to have ways to detect them otherwise it can become a nightmare
Its generally bad practice to let API calls time out.
But 300seconds is a lot of time, and i don’t imagine your API workflows will timeout if its just updating fields. So you’re probably safe.
I know, but to be honest, it’s not something that my platform is based on or needs to actually function. The API Call just refreshes some particular data in my xano table and thats pretty much all.
On the other hand, how do you suggest I make sure it does not fail? Create a webhook that re-runs the api?
@nico.dicagno explain it very will. but you do need a way to tackle errors. you don’t need to create a webbook, just trigger the same bubble API to rerun from xano or simply email your admin that such a error occurs, it will be very helpful in long run.
How do I trigger the api if the api has timed out? Even in xano?
Dont know about XANO, just learning it from Pronocoders. but what i mean was just trigger the same api in bubble which started the process , ONLY WHEN AN ERROR OCURE in XANO.
but yah i am not very helpful in xano, unless i have access to the API endpoint which is doing the process or function. then i maybe helpful.