Skip to content

feat(app): periodic background catalog sync (WorkManager)#11

Open
fabiodalez-dev wants to merge 1 commit into
feat/ci-r8-theme-testsfrom
feat/workmanager-catalog-sync
Open

feat(app): periodic background catalog sync (WorkManager)#11
fabiodalez-dev wants to merge 1 commit into
feat/ci-r8-theme-testsfrom
feat/workmanager-catalog-sync

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

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 Application ServiceLocator; uses the default WorkerFactory.
  • PinakesApplication.onCreate schedules it via enqueueUniquePeriodicWork(KEEP) — idempotent, never duplicates or resets the schedule.
  • Adds androidx.work:work-runtime-ktx 2.9.1 (auto-initialized via androidx.startup, no manifest change).

Verified

  • assembleDebug builds; testDebugUnitTest 37/37 green.
  • Periodic execution timing is WorkManager-standard; an end-to-end run needs a device only for wall-clock scheduling, not for correctness.

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.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fabiodalez-dev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e397c4d1-c664-4064-ac53-ef64081935fe

📥 Commits

Reviewing files that changed from the base of the PR and between 9be3535 and b3c2fea.

📒 Files selected for processing (4)
  • app/build.gradle.kts
  • app/src/main/java/com/pinakes/app/PinakesApplication.kt
  • app/src/main/java/com/pinakes/app/data/sync/CatalogSyncWorker.kt
  • gradle/libs.versions.toml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/workmanager-catalog-sync

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fabiodalez-dev

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant