Optimizing Cancelled Booking API Call in Xano: Reducing Queries and Enhancing Performance
In this meeting, the State Changers discuss an optimization problem involving the cancellation API call in an application, especially related to a looping function. The conversation primarily revolves around Xano as the platform used for application development.
In their application setup, they have a 'canceled booking' API call with several conditionals and a large function. Inside this function, they have a loop for which they are seeking a more efficient approach. Their existing method involves creating a variable to accommodate all the elements garnered from the beginning of an array. These are the waitlist elements linked to its availability. Then, entering a loop, they run a query for all records from availabilities, splitting and adding data into the initial variable.
Seeking a less resource-intensive approach, the State Changers devise a method that involves creating another variable to hold a list of availability IDs. The meeting attendees decide that this method, which operates via a 'stop and debug' process, would be beneficial in enhancing performance, enabling better readability, and improving code maintainability. Subsequently, they proceed with creating a custom query to acquire all the necessary records. The main focus is on preventing multiple round trips for queries, which is achievable through this new method of gathering the full list in one go.
The meeting concludes with the understanding that this optimization makes it feasible to handle larger data quantities without compromising performance. The discussants assure to explore more questions in future meetings.