I have a VF Page where I gather data from Attachments, deserialize the Attachments into Apex Classes, process the data, and then display the data on the VF page with
When trying to load the VF Page, I encounter the following error:
Time limit exceeded - Your request exceeded the time limit for processing.
But when checking the Debug Logs, I have my
Maximum CPU Time: 1069 out of 10000.
I suspect this is a Visualforce timeout, and that it is very likely I have to change my data processing in order to create the desired spreadsheet. Are my suspicions correct?
I'm nearly certain that the timeouts occur due to the use of
JSON methods. My guess is that these methods don't count against
Maximum CPU Time but that each Visualforce request has a time out of ~15 seconds.
When I try collecting the data in
Execute Anonymous, I can pull all my desired data without breaching the
Maximum CPU Time Limit (
~3000 out of 10000), but the requests take ~20-30 seconds to come back with a result.
I am trying to prove that
JSON is causing my errors by creating
sObject records for my JSON data in a Dev Org, and even so, I am still running into the same Visualforce Timeout. I am only dealing with < 4000 records concerning only 5 fields in each record, and even when I replace the
SOQL queries, and I am still timing out. In all of my Debug Logs, I am never using more than
3000 in my
Maximum CPU Time. Is my data processing too intensive though I never breach any Governor Limit? The "Time limit exceeded" error is not an Apex Exception, so I can only surmise this is somehow a Visualforce error. Does this seem logical?
Since I am heavily using Apex, I ended up chopping my code up into steps using
@future methods since they have 60,000 ms of CPU Time (rather than the normal 10,000 ms) and then have the methods save data a JSON attachments along the way. The first thing an
@future methods does is query the Attachment & deserialize the data before continuing processing. The user has to navigate a couple of processing steps, but since
@future methods do, and this is easily within VF Limits.