So currently I have a future method that queries all the fields of an object and queries a large chunk of data, then does some nested for loops to map out field usage.
The problem is once it is used on objects with large amount of fields (700+), it hits CPU Exceeded limit time out of 10min. Not really too much wiggle room on code optimization.
From testing about 100 fields works fine, so i'm wondering if there is a way to queue this up to help avoid this issue?
I tried something like,
public void execute( list<String> totalFields )
{
List<List<String>> splitFields; // totalFields split up by 100 size.
for(List<String> f: splitFields)
{
futuremethod(f);
}
}
So it creates like 7 future jobs, but 4 of them times out, 3 succeeds. I'm curious if there is anything I can do programatically to get all the jobs to succeed, put some delays or timers or something to allow this to work?