jamessimone / jamessimone/apex-rollup
Recursive Behaviour? Scheduled Paths possibly causing an issue
Nobody has claimed this yet.
- Dominant language
- Apex
- Stars
- 266
- Forks
- 37
- Avg merge
- 46m
- Merged PRs (30d)
- 1
Description
Big note first - Huge fan of the apex rollup helper, and use it extensively in our business. Currently drawing a blank here around the behaviour we're seeing, and whether it is inadvertently a bug or some other underlying issue.
Process:
- We have scheduled apex as part of a managed package that mass updates a field daily.
- Updating this field triggers a separate flow that attempts to locate a "matching" record using apex invocables from another managed package. Due to restrictions of this managed package and how they've created their apex actions, we've had to execute the flow with a scheduled path, kicking the process off 1 minute later (this may be relevant)
- If a match is found, and the lookup is populated on a Lead record to an Account, and this change kicks off a separate flow that will execute the apex rollup, to count the "open leads" linked to an Account.
We are currently hitting our async apex limits for a day after executing the above process for 1 record, and all we can see after debugging and our apex jobs, is they're getting flooded with the RollupFullBatchRecalculator, it just keeps firing over and over again. Now we know for a fact that the flow that executes the rollup wouldn't re-fire (it specifically looks at whether account has changed, or other fields that aren't updated in the process) so this should just execute the one time. In our testing, we do admittedly have 600 open Leads linked to the Account already, when we attempt to fire the process for the 1 Lead, but that wouldn't explain how we can end up hitting our 250k daily limit (albeit gradually).
It's also worth noting that we do use the rollup helper for other fields that are heavily updated on a daily basis in Production (Pardot engagement score for example) and we are nowhere near hitting our daily async apex limit. The only difference I can think of is the flow trigger in question, is executed after a scheduled job, but again, I'm grasping at straws.
We're currently trying to set up the process by rolling up the old fashioned way (which is working fine), so the whole thing just feels off, but thought I'd highlight it here in case there is something weird happening off the back of a scheduled path in one flow, that subsequently triggers the other process to rollup. We did try to change the rollup to run sync but looks like our apex jobs still got flooded regardless.
We'll be carrying out some more tests, but would love to hear if we have somehow screwed something up, as the flow firing itself definitely shouldn't be the case!
Contributor guide
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
No source file, test, or entry point is identified. Start by reproducing the scheduled Apex and Flow sequence, then trace the RollupFullBatchRecalculator jobs and async Apex usage; done means identifying a confirmed cause for the repeated jobs or documenting that the behavior originates outside this project.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100