🐛 Fixed duplicate requests for image dimensions of the same URL - #30383
Conversation
no ref A post's coverImage, ogImage, and twitterImage frequently resolve to the same feature_image URL, and getImageDimensions() looks all three up concurrently via Promise.all. Since ImageSize.getImageSizeFromUrl() had no in-flight deduplication, a single cold pageview could fire off multiple simultaneous origin requests (HTTP probe or storage read) for the exact same image. This coalesces concurrent lookups for the same URL into one underlying request, regardless of which cache adapter (or none) is configured, since the dedup lives below the caching layer.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: QUIET Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📜 Recent review details🧰 Additional context used📓 Path-based instructions (5)Review whether tests prove changed behaviour, meaningful error/edge paths, and⚙️ CodeRabbit configuration file Files:
New source files must be TypeScript: flag new JS files as a required change⚙️ CodeRabbit configuration file Files:
Prioritise concrete correctness, security, data-integrity, compatibility,⚙️ CodeRabbit configuration file Files:
New files are TypeScript: Fail if the PR adds a new .js/.jsx/.cjs/.mjs source file, unless it is: a DB📄 CodeRabbit inference engine (Custom checks) Files:
Always use `pnpm`, never npm or Yarn.📄 CodeRabbit inference engine (AGENTS.md) Files:
🔇 Additional comments (2)
Walkthrough
Suggested reviewers: Merge Risk: ⚪ Minimal · up to This PR coalesces concurrent image-dimension requests for identical URLs, reducing duplicate origin or storage reads without changing the requested image data. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
Full details: Type-Safe BoundariesExplanation PASS. The implementation diff adds an in-flight Full details: New Files Are TypescriptExplanation The PR changes only two pre-existing JavaScript files: ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 4m 33s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 2m 25s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 26s | View ↗ |
nx run-many -t test:unit -p ghost |
✅ Succeeded | 40s | View ↗ |
nx run-many -t lint -p ghost,ghost-monorepo |
✅ Succeeded | 23s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 4s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | <1s | View ↗ |
nx run @tryghost/e2e:test:fixtures |
✅ Succeeded | <1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-08-31 15:09:17 UTC
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #30383 +/- ##
=======================================
Coverage 76.07% 76.08%
=======================================
Files 1679 1679
Lines 160133 160157 +24
Branches 19618 19621 +3
=======================================
+ Hits 121829 121850 +21
- Misses 37285 37288 +3
Partials 1019 1019
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

no ref
A post's
coverImage,ogImage, andtwitterImagefrequently resolve to the samefeature_imageURL, andgetImageDimensions()looks all three up concurrently viaPromise.all. SinceImageSize.getImageSizeFromUrl()had no in-flight deduplication, a single cold pageview could fire off multiple simultaneous origin requests (HTTP probe or storage read) for the exact same image. This causes slow page loads whenimageSizecache is not filled for an external image url (including S3Storage setups).This PR coalesces concurrent lookups for the same URL into one underlying request, regardless of which cache adapter (or none) is configured, since the dedup lives below the caching layer. The fix is applied before the internal/external url decision intentionally, so same optimization will be used to avoid re-reading same image multiple times at the same time from the storage.
Got some code for us? Awesome 🎊!
Please take a minute to explain the change you're making:
Please check your PR against these items:
We appreciate your contribution! 🙏