Skip to content

[codex] Cache convoy list refreshes#3

Merged
Spectralgo merged 1 commit intomainfrom
codex/perf-convoys-swr
Apr 25, 2026
Merged

[codex] Cache convoy list refreshes#3
Spectralgo merged 1 commit intomainfrom
codex/perf-convoys-swr

Conversation

@Spectralgo
Copy link
Copy Markdown
Owner

Summary

  • Add a main-process SWR/singleflight cache for gastown.convoys.list keyed by normalized list input.
  • Return the last successful convoy list immediately while stale refreshes run in the background.
  • Add focused router tests for cold duplicate sharing and stale data during refresh.

Performance Note

This masks the 26s gt convoy list --json stall after the first successful load by serving cached convoy data immediately. Optimizing the upstream gt command remains separate.

Validation

  • bun test apps/desktop/src/lib/trpc/routers/gastown/convoys.test.ts
  • bun run --cwd apps/desktop typecheck
  • ./node_modules/.bin/biome check apps/desktop/src/lib/trpc/routers/gastown/convoys.ts apps/desktop/src/lib/trpc/routers/gastown/convoys.test.ts

@Spectralgo Spectralgo marked this pull request as ready for review April 25, 2026 22:14
@Spectralgo Spectralgo merged commit 50901f7 into main Apr 25, 2026
2 of 5 checks passed
@Spectralgo Spectralgo deleted the codex/perf-convoys-swr branch April 25, 2026 22:14
@github-actions
Copy link
Copy Markdown

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

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