Skip to content

Bound the MpakSource module-level cache #199

@mgoldsborough

Description

@mgoldsborough

Problem

MpakSource keeps an unbounded module-level Map keyed by registry base URL (src/registries/mpak-source.ts:51). Every distinct base URL the platform fetches from adds an entry that's never evicted.

In practice tenants run 1–3 mpak rows for the lifetime of the process, so this is a tiny leak. But operators reconfiguring NB_REGISTRIES over many process restarts (or pointing at multiple self-hosted mpaks during testing) accumulate entries indefinitely.

Fix

Either:

  • Convert to a bounded LRU (cap at e.g. 16 distinct base URLs).
  • Move the cache from module scope to per-MpakSource-instance scope so it's GC'd with the source.

Per-instance is the cleaner architectural shape (matches the source contract), but loses the cross-ConnectorDirectory-call sharing today's module cache provides. LRU keeps cross-call sharing.

Surfaced by

QA review of #195 (Suggestion #1, round 4).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions