-
-
Notifications
You must be signed in to change notification settings - Fork 45
MInor Tweaks for Cache and Lazy Load #2982
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
…me after logging in
📝 WalkthroughWalkthroughThis pull request removes the Sequence Diagram(s)sequenceDiagram
participant Activity as SyncActivity/DataPullTask
participant PECH as PrimeEntityCacheHelper
participant WM as WorkManager
participant ECU as EntityCacheInvalidationWorker
Activity->>PECH: scheduleEntityCacheInvalidation()
PECH->>WM: Enqueue one-time work request (with ENTITY_CACHE_INVALIDATION_REQUEST)
WM->>ECU: Execute doWork()
alt Cache is not empty
ECU->>ECU: processShallowRecords()
else Cache is empty
ECU->>ECU: Skip processing shallow records
end
alt Session is active
ECU->>PECH: schedulePrimeEntityCacheWorker()
end
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🔇 Additional comments (10)
✨ 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 (
|
|
@coderabbitai full review |
|
@damagatchi retest this please |
|
@coderabbitai full review |
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.
Looks good to me!
| } finally { | ||
| // we want to schedule the Prime worker irrespective of result of this task | ||
| if (CommCareApplication.isSessionActive()) { | ||
| PrimeEntityCacheHelper.schedulePrimeEntityCacheWorker() |
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.
Honestly, I don't like that these two methods refer to different static singletons with different lifecycles. I'm worried this code has the risk of further spreading out access to static / singleton lifecycles while also being fairly likely to be executed in contexts where those lifecycles are changing (right after login, or when a user has completed a form and is logging out for the day).
My guess here is that it's better to make "the other half" of any calls like this that depend on multiple singleton contexts get pushed into one of them, so that at least there's no ambiguity at runtime about which memory space or sandbox the second call is going to be running against.
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.
Not completely sure if I got you right but did you mean like this ?
ecb361e to
091cd01
Compare
Technical Summary
A few minor tweaks and pending feedback for cache and lazy load feature. Review commit by commit.
Labels and Review
cross-request: dimagi/commcare-core#1463