Ouroboros does not re-enqueue
Nobody has claimed this yet.
- Dominant language
- Apex
- Stars
- 110
- Forks
- 15
- Avg merge
- 1m
- Merged PRs (30d)
- 7
Description
Summary
In Ouroboros, it does not re-enqueue because it thinks it is unsafe to do so.
In safeToEnqueueAccordingToLimits, the following line is always returning false:
return (Limits.getLimitQueueableJobs() - (Limits.getQueueableJobs() + 1) > 0
Limits.getLimitQueueableJobs() returns 1 for async code
Limits.getQueueableJobs() returns 0 if no additional jobs have been enqueued
Thus safeToEnqueueAccordingToLimits thinks it is not safe to enqueue the next job.
I believe this can be fixed by removing the +1. I'd be interested to know the purpose of that part of the statement.
Salesforce Org Type
Scratch Org
Steps To Reproduce
Create an Ouroboros that re-enqueues itself a few times.
Current Behavior
Only the first iteration runs
Expected Behavior
Ouroboros re-enqueues jobs until the exit criteria is met
Relevant Log Output
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at safeToEnqueueAccordingToLimits and inspect how Limits.getLimitQueueableJobs() and Limits.getQueueableJobs() are used for async execution. Reproduce an Ouroboros that re-enqueues itself and verify that it continues running until its exit criteria is met.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100