Problem
extensions/discord/src/internal/entity-cache.ts caches user:, channel:, guild:, and member: REST fetches in a Map with a 30-second TTL. The TTL is only checked on a same-key re-fetch inside fetchCached. Different keys never trigger any sweep, and there is no max-size cap.
On a long-lived gateway, every distinct entity the bot has ever touched stays retained past its TTL until process restart. Slow, predictable leak proportional to entity cardinality.
Repro is straightforward: drive the unpatched fetchCached path with N unique keys → Map grows to N regardless of TTL.
Tracking PR
Fix in #77952.
Problem
extensions/discord/src/internal/entity-cache.tscachesuser:,channel:,guild:, andmember:REST fetches in aMapwith a 30-second TTL. The TTL is only checked on a same-key re-fetch insidefetchCached. Different keys never trigger any sweep, and there is no max-size cap.On a long-lived gateway, every distinct entity the bot has ever touched stays retained past its TTL until process restart. Slow, predictable leak proportional to entity cardinality.
Repro is straightforward: drive the unpatched
fetchCachedpath with N unique keys → Map grows to N regardless of TTL.Tracking PR
Fix in #77952.