Periodically prunes expired sessions from a ConduitMcp.Session.Store.
ETS-backed stores accumulate session entries indefinitely without an
explicit eviction loop. Without a janitor, every successful initialize
request adds a row to the session table that lives until the BEAM restarts;
for a public-facing MCP server this is an unbounded memory growth surface.
Stores backed by systems with native TTL (Redis with EX, Mnesia with TTL
indices, etc.) do not need this janitor.
Usage
Add the janitor to your application supervision tree:
children = [
{ConduitMcp.Session.Janitor,
store: ConduitMcp.Session.EtsStore,
ttl: :timer.minutes(30),
interval: :timer.minutes(1)},
# ...
]Options
:store(required) — module implementingConduitMcp.Session.Storethat defines acleanup/1callback.:ttl— maximum session age in milliseconds (default: 30 minutes). Sessions whosecreated_atexceeds this age are evicted.:interval— interval between cleanup runs in milliseconds (default: 1 minute).:name— registered process name (default: module name).
Emits [:conduit_mcp, :session, :cleanup] telemetry on each run with
metadata %{store: store, removed: count}.
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.