[Web Import] Enable persistent cache to avoid re-fetching icons on every plugin restart#912
Conversation
…ery plugin restart
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds HTTP response caching to the Ktor HttpClient used by the IDE plugin by installing HttpCache with filesystem-backed storage at 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt (1)
35-35: Use a cache-specific subdirectory for cleaner storage boundaries.Using
.../valkyrie/http-cache(instead of just.../valkyrie) makes cleanup and future storage separation safer.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt` at line 35, The cacheDir currently points to the generic Valkyrie system folder; change it to a cache-specific subdirectory so HTTP cache files live under a dedicated folder. Update the expression that sets cacheDir in NetworkModule (the variable named cacheDir using Paths.get(PathManager.getSystemPath()).resolve("valkyrie")) to resolve an additional "http-cache" segment (e.g., resolve("valkyrie").resolve("http-cache") or equivalent) so the path becomes .../valkyrie/http-cache.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt`:
- Around line 34-38: The HttpCache setup in NetworkModule.kt currently calls
Files.createDirectories(...) and constructs FileStorage(cacheFile) without
protection, so filesystem errors can break HttpClient construction; wrap the
install(HttpCache) cacheDir/cacheFile creation and
publicStorage(FileStorage(...)) call in a try/catch that on failure logs a
warning and falls back to an in-memory/no-op cache (i.e., skip publicStorage or
use a memory-based storage) so HttpClient still constructs and web import
degrades gracefully; refer to the install(HttpCache) block, cacheDir/cacheFile,
and publicStorage(FileStorage(cacheFile)) when applying the change.
---
Nitpick comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt`:
- Line 35: The cacheDir currently points to the generic Valkyrie system folder;
change it to a cache-specific subdirectory so HTTP cache files live under a
dedicated folder. Update the expression that sets cacheDir in NetworkModule (the
variable named cacheDir using
Paths.get(PathManager.getSystemPath()).resolve("valkyrie")) to resolve an
additional "http-cache" segment (e.g., resolve("valkyrie").resolve("http-cache")
or equivalent) so the path becomes .../valkyrie/http-cache.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tools/idea-plugin/CHANGELOG.mdtools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt
ref: https://ktor.io/docs/client-caching.html#persistent_cache
Demo:
95552cce-0fad-49d2-b936-0bdbcd34c7ed.mov
📝 Changelog
If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs: