How to save batch of data in Parse Cloud Code? How to save batch of data in Parse Cloud Code? javascript javascript

How to save batch of data in Parse Cloud Code?


Basically in cloud architecture, request time out time is around 60 sec, but you try to insert over thousands records in one transaction , it takes more than 60 seconds, that's why your request always fail.

There's better ways to insert bigger amount of records,

  1. Task Queues
  2. Cron or scheduled task

I think task queue is better for your problem.watch this video, you can get super idea about task queues

Task queue & cron jobs


Workaround: You could schedule a cron job in batches of an acceptably low number of records, limited by the hosting services limit you have. For example, if you can only process 10 requests every minute, you would first request all the IDs that need to be updated, then split them into chunks that the server will accept and process within the time limit. It's just a workaround.

Long-Term: A better solution would be to design your app to request as little data as possible from the server, rather than forcing the server to do all the heavy lifting. This also allows your business logic to be exposed through a convenient public API, rather than sitting as a hidden process on your server.