Threadline.Retention.Pruner (Threadline v0.6.0)

Copy Markdown View Source

A GenServer that schedules and executes background retention pruning.

Ensures only one node in the cluster runs the pruning process concurrently using PostgreSQL advisory locks.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the pruner GenServer.

Returns whether the named pruner runtime is currently available.

Triggers an immediate prune on the supervised runtime path.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

Starts the pruner GenServer.

Options

  • :repo (required) - The Ecto.Repo to use for DB operations.
  • :interval_ms (optional) - Time between pruning attempts (default: 60 minutes).
  • :sleep_ms (optional) - Sleep time between batches to yield DB locks (default: 50 ms).

started?()

Returns whether the named pruner runtime is currently available.

trigger()

Triggers an immediate prune on the supervised runtime path.