Skip to content

Backup jobs

Backup health gathers jobs from every integration that offers them. Return backups beside widgets. It answers with a list of jobs; Valet works out what’s late, failing or oddly sized.

async backups() {
const jobs = await api('/jobs');
return jobs.map(j => ({
name: j.name, // the only thing required
lastSuccess: j.lastGoodAt, // ms or an ISO date
lastRun: j.lastRunAt,
result: j.ok ? 'ok' : 'failed', // or 'warning', 'running'
error: j.error,
size: j.bytes, // the whole of what it keeps, not what one run added
next: j.nextAt,
every: j.intervalMs,
}));
}
Field
namethe job, plan or source
sourcewhat runs it, e.g. “Kopia”; your integration’s name if left out
lastSuccesswhen it last finished without an error
lastRun, resultwhen it last ran at all, and how: ok, warning (worked, worth a look), failed (a problem until a run works) or running
errorwhy it failed, in the service’s words
size, sizesbytes now, and earlier sizes oldest first if the service keeps them. Otherwise Valet remembers
nextwhen it runs next
everyms it should never go without a success, if the service knows its schedule. Without it, the gap from lastRun to next is used, then backups.overdue
hrefwhere to look at it

Leave out what the service doesn’t say. A job that doesn’t fit the shape is left out, never trusted, and a backups() that throws is shown as “couldn’t ask”.

In a built-in service(), backups: (d, o) => [...] reads the same answers as the card, and backupGet adds calls made only when backups are asked. The sample must give at least one job: npm test checks it.