feat(app): periodic background catalog sync (WorkManager)#11
feat(app): periodic background catalog sync (WorkManager)#11fabiodalez-dev wants to merge 1 commit into
Conversation
The offline catalog snapshot (Room, added in the offline-cache work) was only refreshed on app foreground. Add a WorkManager periodic worker so it stays fresh even when the app isn't opened — the offline "Available now" shelf works without hammering the server. - CatalogSyncWorker (CoroutineWorker): refreshes the cached catalog every 6h on a connected network; no-ops when logged out; Result.retry() on network failure. Reaches dependencies through the Application ServiceLocator; uses the default WorkerFactory (standard constructor). - PinakesApplication.onCreate schedules it via enqueueUniquePeriodicWork(KEEP) — idempotent, never stacks duplicates or resets the schedule. - Adds androidx.work:work-runtime-ktx 2.9.1. Verified: assembleDebug builds; testDebugUnitTest 37/37 green.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Second in the "production-grade" series. Stacked on #10 (CI/R8) which is stacked on #9 (offline cache). Merge order: #9 → #10 → this.
What
The offline catalog snapshot (Room) was only refreshed on app foreground. This adds a WorkManager periodic worker so it stays fresh even when the app isn't opened — the offline "Available now" shelf keeps working without a server round-trip on every screen.
CatalogSyncWorker(CoroutineWorker) — refreshes the cached catalog every 6h on a connected network; no-ops when logged out;Result.retry()on network failure. Reaches deps via the ApplicationServiceLocator; uses the defaultWorkerFactory.PinakesApplication.onCreateschedules it viaenqueueUniquePeriodicWork(KEEP)— idempotent, never duplicates or resets the schedule.androidx.work:work-runtime-ktx2.9.1 (auto-initialized via androidx.startup, no manifest change).Verified
assembleDebugbuilds;testDebugUnitTest37/37 green.