+ Start a Discussion
Haystack CertifiedHaystack Certified 

Queueable class and governor limits

Do queued jobs using Queueable class get their own set of govenor limits?  For example, the limit for DMLs is 150.  If a trigger has 10 DMLs, does the queued job still have all 150 DMLs allowed?
Best Answer chosen by Haystack Certified
Martijn SchwarzerMartijn Schwarzer
Hi Haystack,

Yes, every queued job using Queueable class has its own set of limits. This is because this is a separate transaction.

You can test that by creating a Queueable class for test purposes like this:
public class TestQueueableLimits implements Queueable {
    public void execute(QueueableContext context) {
        System.debug('DML Statements Limit: ' + String.valueOf(Limits.getLimitDMLStatements()));
	    System.debug('DML Statements used: ' + String.valueOf(Limits.getDMLStatements()));    

The result is:

21:00:14:006 USER_DEBUG [4]|DEBUG|DML Statements Limit: 150
21:00:14:006 USER_DEBUG [5]|DEBUG|DML Statements used: 0

Happy coding!

Best regards,
Martijn Schwärzer