lt.maintenance
lt.maintenance reads and replaces the maintenance schedule: a cron that runs ordered prune and delete rules against one namespace. For one-off pruning, use lt.dba.
getConfig
Section titled “getConfig”const result = lt.maintenance.getConfig();Return the current maintenance configuration and whether it is active. This call is synchronous.
Parameters: none.
Returns: LTApiResult<{ config: LTMaintenanceConfig | null, active: boolean }>
Auth: Not required.
updateConfig
Section titled “updateConfig”const result = await lt.maintenance.updateConfig({ appId: 'durable', schedule: '0 3 * * *', rules: [ { target: 'streams', action: 'delete', olderThan: '7 days' }, { target: 'jobs', action: 'prune', olderThan: '90 days', hasEntity: true }, { target: 'escalations', action: 'delete', olderThan: '180 days', statuses: ['resolved', 'cancelled'] }, ],});Replace the maintenance configuration and restart the cron. The new schedule starts at once.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
appId |
string |
Yes | Namespace to maintain |
schedule |
string |
Yes | Cron expression (for example '0 3 * * *') or interval (for example '1 day') |
rules |
LTMaintenanceRule[] |
Yes | Rules, run in order each cycle |
Each LTMaintenanceRule:
| Field | Type | Required | Description |
|---|---|---|---|
target |
'streams' | 'jobs' | 'escalations' | 'oauth' |
Yes | Resource to act on. oauth is the MCP authorization server’s clients, grants, codes and refresh tokens |
action |
'delete' | 'prune' |
Yes | delete hard-deletes rows; prune strips execution artifacts |
olderThan |
string |
Yes | Postgres interval, for example '7 days' |
hasEntity |
boolean |
No | For jobs: true targets entity jobs, false transient jobs |
pruned |
boolean |
No | Only target jobs already pruned |
statuses |
Array<'resolved' | 'cancelled' | 'expired'> |
No | For escalations: which terminal statuses to age out (default all three). Pending rows and live waits are left in place |
Returns: LTApiResult<{ config: LTMaintenanceConfig, restarted: true }>. 400 when appId, schedule or rules is missing.
Auth: Not required.
