Run whole-data archives and restores in the background
A data archive or restore ran inside its request, which sent nothing until tar finished: Bun closes a silent socket after 10s (its default idleTimeout in production) and a proxy cuts it at about 100s, so the page showed a network error while the archive kept going, and a retry said another backup was already running. The routes now start the run (startDataBackupRun, refused while the backup lock is held) and answer at once. The page follows it by polling api/admin/backups/data-status: an archive reloads once written, a restore once the status comes from a new process after its restart, and a failure shows its error. A run in progress survives a reload. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -1212,6 +1212,32 @@ export type DataBackup = {
|
||||
size: number;
|
||||
};
|
||||
|
||||
export type DataBackupRunKind = "archive" | "restore";
|
||||
|
||||
/**
|
||||
* The whole-data archive or restore this process last started
|
||||
* (`startDataBackupRun`), which the backups page polls while it runs.
|
||||
* `boot_id` changes when the process restarts, which is how the page
|
||||
* knows a restore finished.
|
||||
*/
|
||||
export type DataBackupRun = {
|
||||
status: "idle" | "running" | "done" | "failed";
|
||||
kind?: DataBackupRunKind;
|
||||
started_at?: number;
|
||||
finished_at?: number;
|
||||
/**
|
||||
* The archive written or restored.
|
||||
*/
|
||||
name?: string;
|
||||
error?: string;
|
||||
boot_id: string;
|
||||
};
|
||||
|
||||
export type DataBackupStatus = {
|
||||
run: DataBackupRun;
|
||||
data_backups: DataBackup[];
|
||||
};
|
||||
|
||||
export type BotVoicePayload = {
|
||||
transcription: boolean;
|
||||
speech: boolean;
|
||||
@@ -1328,6 +1354,7 @@ export type PagePropsType = {
|
||||
has_password?: boolean;
|
||||
backups?: DbBackup[] | null;
|
||||
data_backups?: DataBackup[] | null;
|
||||
data_backup_run?: DataBackupRun | null;
|
||||
harness_overview?: HarnessOverviewPayload | null;
|
||||
bot_harness_overview?: BotHarnessOverviewPayload | null;
|
||||
envs_overview?: EnvsOverviewPayload | null;
|
||||
|
||||
Reference in New Issue
Block a user