Timeline for Apex: I'm shoving all the DML into a queued job, but still get "Uncommited work pending"
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 24, 2022 at 15:59 | vote | accept | pilat | ||
Nov 21, 2022 at 15:53 | comment | added | sfdcfox♦ | @pilat That's a Developer/Sandbox limitation. In production, you wouldn't encounter that error. | |
Nov 21, 2022 at 15:17 | comment | added | pilat | I mean, there's no loop now, just enqueuing the same class with the next page number in the arguments | |
Nov 21, 2022 at 15:15 | comment | added | pilat |
Ok, i've redesigned it a bit: public with sharing class SyncResponses implements Queueable, Database.AllowsCallouts { public void syncIt() { url = '/responses?page=' + this.page; .. some checks that next page is possible ..; System.enqueueJob(new SyncResponses(this.page+1); }} Now I get System.AsyncException: Maximum stack depth has been reached. when trying to test is… After the third page.
|
|
Nov 21, 2022 at 11:42 | history | answered | sfdcfox♦ | CC BY-SA 4.0 |