3

CPU time out limit was being hit while processing child records on the inline opportunity visualforce page, to handle this i wrote a remoteActionFunction on the page that invokes controller method that's taking long to process and when i get CPU LIMIT exception in the result, i am invoking javascript call back function that invokes a action function which handles the same code asynchronously(@future).

Question: by setting the timeout (Visualforce.remoting.timeout = 120000;) can't we overcome CPU TIME out limit of 10,000 ms.

2

No. The 10k ms limit is a governor limit. The Visualforce remoting limit determines the total time that a remote action will wait before declaring that there was no response from the server. You can view these as separate limits, one being for the server, and the other for the client. They are mutually exclusive.

  • Thank you! is it ok to invoke action function associated with future method from a call back function of remote action? – FromShafi Aug 14 '14 at 18:45
  • You should be able to, but since it's a future method, you can't get any result back (it'll be void). What exactly are you hoping to accomplish? – sfdcfox Aug 14 '14 at 19:18
  • visualforce page controller has a complex logic to create child records, when processing these records, CPU limit is hit. To have more CPU time i am invoking future method to handle all the processing, it need not have to return any result as i am sending out an email after future method is completed. some times even the future method is timing out so i have requested salesforce to enable pilot feature of @future("2XCPU TIME LIMIT") to our org. – FromShafi Aug 14 '14 at 19:27
  • @FromShafi Sounds like you really need a batch process though, if it's that intense. You'll have all the time you need to run your process then. – sfdcfox Aug 14 '14 at 19:56
  • 1
    You could always split the task up into up to 10 future methods on your page, so they're all processed asynchronously, if that would help, or you could also be sneaky and write a REST or webservice function, and call that to extend the total CPU time at the cost of API calls. – sfdcfox Aug 14 '14 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.