Skip to content

Invalidate mpak source cache on RegistryStore.update so admin edits feel immediate #197

@mgoldsborough

Description

@mgoldsborough

Problem

MpakSource caches its searchServers result at module scope with a 5-minute TTL (src/registries/mpak-source.ts:CACHE_TTL_MS). When an operator flips a registry's enabled flag or changes scopes via the admin UI, Browse can show stale results for up to 5 minutes — confusing and feels broken.

Fix

After RegistryStore.update() returns, call _resetMpakSourceCache() so the next getConnectorDirectory().list() re-fetches.

The simplest place to wire this is in the admin tool that handles registry mutations (likely manage_registries.update_registry or wherever runtime.getRegistryStore().update() is called). One line per call site, or better: have RegistryStore.update() invoke a registered callback.

Cleanest pattern:

  1. MpakSource registers a hook on the store at module load.
  2. RegistryStore.update() fires the hook after a successful write.
  3. Hook calls _resetMpakSourceCache().

Same pattern would let other source types invalidate caches without coupling.

Surfaced by

QA review of #195 (Suggestion #3).

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