Skip to content

perf(bun): cache plugin versions with TTL to avoid reinstalling on every startup#6826

Closed
xammen wants to merge 1 commit into
anomalyco:devfrom
xammen:fix/plugin-cache-latest-version
Closed

perf(bun): cache plugin versions with TTL to avoid reinstalling on every startup#6826
xammen wants to merge 1 commit into
anomalyco:devfrom
xammen:fix/plugin-cache-latest-version

Conversation

@xammen

@xammen xammen commented Jan 4, 2026

Copy link
Copy Markdown

Summary

  • Fixes slow startup (~21 seconds) caused by reinstalling plugins on every launch
  • When plugins use @latest, the cache now tracks timestamps and reuses cached versions for 24 hours
  • Reduces plugin loading time from ~21s to <1s

Problem

The cache check compared 'latest' against the resolved version (e.g., '2.12.2'), which never matched:

if (parsed.dependencies[pkg] === version) return mod  // 'latest' !== '2.12.2'

Solution

  • Added _timestamps field to track when packages were installed
  • For @latest requests, reuse cached version if installed within 24 hours
  • Still allows periodic updates while avoiding redundant reinstalls

…ry startup

When plugins use @latest version, the cache check compared 'latest' against
the resolved version (e.g., '2.12.2'), which never matched, causing a full
reinstall of all plugins on every startup (~20+ seconds).

This fix:
- Adds timestamp tracking for cached packages
- For @latest requests, reuses cached version if installed within 24 hours
- Resolves and stores the actual version after installation

Reduces startup time from ~21s to <1s for plugin loading.
@xammen xammen changed the title fix(bun): cache plugin versions with TTL to avoid reinstalling on every startup perf(bun): cache plugin versions with TTL to avoid reinstalling on every startup Jan 4, 2026
@rekram1-node

Copy link
Copy Markdown
Collaborator

this doesnt seem like a good solution, if this is the issue:

The cache check compared 'latest' against the resolved version (e.g., '2.12.2'), which never matched:

if (parsed.dependencies[pkg] === version) return mod  // 'latest' !== '2.12.2'

Why not just compare to the actual version that we have installed as a fix then?

@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Mar 6, 2026
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.

2 participants