function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DML2020DML2020 

Wait time added between batches in scheduled chron job

For a scheduled chron job that processes say, 200 batches at a time, a pause of say, 20 minutes, needs to be introduced in between each batch that's processed.

How would that be accomplished?
What should the code look like?
Where should it be inserted?

Best Answer chosen by DML2020
Suraj Tripathi 47Suraj Tripathi 47

Hi DML2020
You can't hold the chunks for a while. You can simply schedule the batch Apex for a certain amount of time.

ProcessAccs pa= new ProcessAccs();
String cronStr = '0 0,20 * * * *';
System.schedule('Process Accs Job', cronStr, pa);


I hope you find the above solution helpful. If it does, please mark it as the Best Answer to help others too.

Thanks and Regards,
Suraj Tripathi