Repository navigation
Reduce metadata image cache R2 churn - #249
Conversation
|
Warning Review limit reached
Next review available in: 41 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 Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR refactors image variant uploads to skip already-existing S3 objects and return uploaded/existing counts. It caps cached original image dimensions and normalizes thumbhash input. The metadata job repo gains failure-aware retry backoff for stable provider errors and a flag to requeue already-succeeded provider artwork jobs. Variant counts propagate through the processor and task completion reporting. ChangesImage Cache: Skip-Existing Uploads, Dimension Caps, and Variant Count Reporting
Image Cache Job Repo: Failure Backoff and Requeue-Succeeded
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/metadata/image_cache_job_repo.go (1)
406-420: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winPreserve the 7-day cooldown when failed jobs are rediscovered.
Line 406 stores a 7-day
next_attempt_atfor stable provider failures, but the enqueue/discovery paths still reactivatefailedrows based onupdated_at < NOW() - imageCacheFailedRetryAfter— currently 6 hours. Once a stable failure reachesstatus='failed', discovery can reset it toqueuedafter 6 hours and bypass the intended cooldown. Prefer usingnext_attempt_at <= NOW()for failed-row eligibility in the UPSERT and existing-provider candidate query.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/metadata/image_cache_job_repo.go` around lines 406 - 420, The failed-job rediscovery logic in imageCacheJobRepo is using updated_at-based age checks, which can re-queue stable provider failures before their 7-day next_attempt_at cooldown expires. Update the UPSERT path and the existing-provider candidate query in imageCacheFailureRetryDelay/imageCacheFailedRetryAfter handling so that rows with status='failed' are only eligible when next_attempt_at <= NOW(), preserving the intended cooldown. Keep the fix localized around the metadata_image_cache_jobs selection and reactivation logic in imageCacheJobRepo.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@internal/metadata/image_cache_job_repo.go`:
- Around line 406-420: The failed-job rediscovery logic in imageCacheJobRepo is
using updated_at-based age checks, which can re-queue stable provider failures
before their 7-day next_attempt_at cooldown expires. Update the UPSERT path and
the existing-provider candidate query in
imageCacheFailureRetryDelay/imageCacheFailedRetryAfter handling so that rows
with status='failed' are only eligible when next_attempt_at <= NOW(), preserving
the intended cooldown. Keep the fix localized around the
metadata_image_cache_jobs selection and reactivation logic in imageCacheJobRepo.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a410f754-8110-4840-ad6f-39eca77a6000
📒 Files selected for processing (9)
internal/imagecache/imagecache.gointernal/imagecache/imagecache_test.gointernal/imageutil/imageutil.gointernal/metadata/image_cache_job_repo.gointernal/metadata/image_cache_job_repo_test.gointernal/metadata/image_cache_processor.gointernal/metadata/types.gointernal/taskmanager/tasks/cache_metadata_images.gointernal/taskmanager/tasks/cache_metadata_images_test.go
* Reduce metadata image cache R2 churn * Preserve image cache failure cooldowns --------- Co-authored-by: rxwatcher <[email protected]>
Summary
Verification
Summary by CodeRabbit
New Features
Bug Fixes