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
HareHare 

Failing batch class daily : First error: [REQUEST_RUNNING_TOO_LONG] Your request was running for too long, and has been stopped.

Hi All,

I wrote a batch class which updating records. as per batch query it is returning 70 records .. but it is failing every time in prodution  with this "First error: [REQUEST_RUNNING_TOO_LONG] Your request was running for too long, and has been stopped.". error . in prod also 70 record with batch query condition . 

Thanks,
Hare
Raj VakatiRaj Vakati
Each Apex transaction has a Maximum execution time of 10 minutes which is distinct from the Maximum CPU time per transaction on the Salesforce servers of 10,000 milliseconds for synchronous code and 60,000 milliseconds for asynchronous code. The 10 minute time limit exists to help prevent a thread from "hogging" server resources because the of the below limitation on what's counted towards CPU usage limits:



Operations that don’t consume application server CPU time aren’t counted toward CPU time. For example, the portion of execution time spent in the database for DML, SOQL, and SOSL isn’t counted, nor is waiting time for Apex callouts.



Kill the job and reconfigure the job with lower batch size and see 

https://salesforce.stackexchange.com/questions/97355/what-causes-request-running-too-long-test-errors