I have a CloudCode task that is triggered from the app, but sometimes takes longer than a minute to run. How do I ensure that the request from the app doesn't time out?
With such CloudCode tasks, the request from the app times out after a minute, even though the CloudCode task itself keeps running on the server side until it completes (or hits the duration limit).
If you can't easily reduce the duration of the task, you can change to an asynchronous workflow, which would also avoid blocking the user for the entire time:
- Create a new object to initiate the call.
- Have a "ready" webhook on that model to call the CloudCode task.
- If you need to give feedback to the user, you can use something like setInterval() with an OnlineDB call to poll for updates.