Skip to content

feat(amboss): In-memory TTL caching of edge and node alias - #778

Open
mutatrum wants to merge 1 commit into
apotdevin:masterfrom
mutatrum:feat/amboss-in-memory-cache
Open

mutatrum wants to merge 1 commit into
apotdevin:masterfrom
mutatrum:feat/amboss-in-memory-cache

Conversation

@mutatrum

@mutatrum mutatrum commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The Amboss API is repeatedly queried for node alias and edge fee info, from separate UI widgets simulatneously, resulting in quite a lot of latency and can possibly overwhelms or rate limits the Amboss API.

This PR adds an in-memory TTL cache. Cache policies are to be discussed, but for now:

  • Channel: 24 hours, max 5000 items
  • Node: 12 hours

Currently it's using a simple FIFO eviction policy, it's possible to hook up lru-cache, which is a transient dependency of Apollo and Jest, but that might be overkill here. I don't think there are 5000 channel nodes out there.

This PR also adds de-duplication of requests, in case multiple concurrent requests ask for the same edge data or alias. Cache misses are held for an hour.

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