-
-
Notifications
You must be signed in to change notification settings - Fork 45
Cache Prime Fix: Reuse entity factory for cache prime #3018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is necessary to be able to populate cache correctly in primeCache as otherwise we don't have values like mTemplateIsCachable and mCacheHost correctly initialized
📝 WalkthroughWalkthroughThe pull request propagates a new factory parameter through various caching and entity loading operations. In the Sequence Diagram(s)sequenceDiagram
participant AA as AndroidAsyncNodeEntityFactory
participant PEC as PrimeEntityCacheHelper
participant ELH as EntityLoaderHelper
participant F as Factory Instance
AA->>PEC: primeEntityCacheForDetail(..., factory: this)
PEC->>PEC: Validate caching conditions
PEC->>ELH: Instantiate EntityLoaderHelper(..., factory)
ELH->>F: Invoke methods (expandReferenceList, prepareEntities, etc.)
sequenceDiagram
participant ET as EntityLoaderTask
participant ELH as EntityLoaderHelper
participant F as Factory Instance
ET->>ELH: Construct EntityLoaderHelper(..., factory: null)
ELH->>ELH: If factory is null, execute local instantiation logic
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code Graph Analysis (2)app/src/org/commcare/tasks/EntityLoaderTask.java (2)
app/src/org/commcare/tasks/EntityLoaderHelper.kt (1)
🔇 Additional comments (15)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
avazirna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me.
Technical Summary
https://dimagi.atlassian.net/browse/SC-4402
This is necessary to be able to populate cache correctly in primeCache as otherwise we don't have values like mTemplateIsCachable and mCacheHost correctly initialized which results into the
primeCachemethod to exit early and not populate cache into memory resulting into a performance hit.Feature Flag
Cache and Lazy Load
Safety Assurance
Safety story
The change allows us to reuse the factory class which should be harmless for normal use cases that doesn't involve entity caching. The pass on integration test should confirm this further.
QA Plan
None
Labels and Review