I have a System.Queuable job, on a particular Sandbox that is giving me issues. It works fine on other Orgs, but fails on this particular one.
The job structure is this:
- Batch Apex job calls
System.enqueueJob
(batch size of 1) - System.Queueable execute method calls
System.enqueueJob
again, to a level of 4 deep (which makes 5 including the one in Batch job)
This essentially yields the following stack of jobs:
- Parent (enqueued in Batch Apex)
- Child
- Grandchild
- Great Grandchild
- Great Great Grandchild
- Great Grandchild
- Grandchild
- Child
As I said, this works fine on a DE org, but when I enqueueing the Child job on Sandbox, it fails with:
System.AsyncException: Maximum callout depth has been reached.
The documentation states:
Queueable Apex Limits
- The execution of a queued job counts once against the shared limit for asynchronous Apex method executions.
- You can add up to 50 jobs to the queue with System.enqueueJob in a single transaction.
- No limit is enforced on the depth of chained jobs, which means that you can chain one job to another job and repeat this process with each new child job to link it to a new child job. For Developer Edition and Trial organizations, the maximum stack depth for chained jobs is 5, which means that you can chain jobs four times and the maximum number of jobs in the chain is 5, including the initial parent queueable job.
- When chaining jobs, you can add only one job from an executing job with System.enqueueJob, which means that only one child job can exist for each parent queueable job. Starting multiple child jobs from the same queueable job isn’t supported.
I believe I am reading the 3rd point correctly, and I should not be experiencing this issue. Anyone any thoughts?
(additionally, this sandbox is not producing any logs)