ExAgent.Store.Postgres.Maintenance (ExAgent v3.0.0)

View Source

Supervised cleanup for a PostgreSQL Store.

Stability — Stable.

Run unified migration 1 and start the Repo before this child.

{ExAgent.Store.Postgres.Maintenance, repo: MyApp.Repo, table: "my_snapshots"}

Each pass reclaims a page of expired finite erasure tombstones and inspects a page of fork links, continuing from the previous link page. It also checks the default snapshots table used by Jobs and reclaims a page of eligible retired Jobs records when Oban is available.

The first pass runs after five seconds. The delay doubles up to one minute when a pass confirms no deletions and returns to five seconds after a pass confirms a deletion. A failed target emits the PostgreSQL maintenance failure event described by ExAgent.Telemetry.

Summary

Functions

Returns a specification to start this module under a supervisor.

Start the maintenance child. Requires :repo, a PostgreSQL Ecto Repo. :table is the snapshots table name and defaults to "exagent_snapshots".

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Start the maintenance child. Requires :repo, a PostgreSQL Ecto Repo. :table is the snapshots table name and defaults to "exagent_snapshots".

Candidate options :interval_ms and :max_interval_ms set the initial and maximum delays. Both are positive integer milliseconds up to 4,294,967,295. The maximum must be at least the initial delay. Invalid options raise ArgumentError before the process starts.