Question:
[I have a wix site that needs to make an API call to an external system to get updates for a large dataset, over 5000 records. the code keeps timing out. What is the best solution to solve this problem?.]
Product:
[Which editor or feature is your question most relevant to? e.g. Wix Editor.]
What are you trying to achieve:
[Update records daily.]
What have you already tried:
[Multiple batch runs that time out.]
Additional information:
[Include any other pertinent details or information that might be helpful for people to know when trying to answer your question.]
This seems like a great use case for the Job Scheduler. Using the Job Scheduler you can create a reoccurring job that calls a function which updates the records regularly.
An advantage of using a job is that your function can run for 5 minutes, which is longer than the standard timeout for backend functions.
For greater time efficiency, I recommend using bulkUpdate() from the Wix Data API as it will allow you to update 1000 records in one function call versus using the standard update() for one record at a time.
Thank you, Thomas, great help. Do you by any chance have a sample code of how bulk data will work?