fix: more backup errors
All checks were successful
Deploy to Staging / Build Images (push) Successful in 2m35s
Deploy to Staging / Deploy to Staging (push) Successful in 37s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2026-01-01 14:50:09 -06:00
parent 9043a581b1
commit aa441b185f
4 changed files with 19 additions and 8 deletions

View File

@@ -408,13 +408,23 @@ export const adminApi = {
return response.data;
},
// Execute restore
// Execute restore (longer timeout since this is a long-running operation)
restore: async (id: string, options?: ExecuteRestoreRequest): Promise<{ message: string }> => {
try {
const response = await apiClient.post<{ message: string }>(
`/admin/backups/${id}/restore`,
options
options,
{ timeout: 120000 } // 2 minute timeout for restore operations
);
return response.data;
} catch (error: any) {
// If a restore is already in progress, treat it as success since it will complete
const errorMessage = error?.response?.data?.error || error?.message || '';
if (errorMessage.includes('already in progress')) {
return { message: 'Restore is in progress and will complete shortly' };
}
throw error;
}
},
// Schedules

View File

@@ -147,6 +147,7 @@ export const useExecuteRestore = () => {
return useMutation({
mutationFn: ({ id, options }: { id: string; options?: ExecuteRestoreRequest }) =>
adminApi.backups.restore(id, options),
retry: false,
onSuccess: (data) => {
queryClient.invalidateQueries({ queryKey: backupKeys.all });
toast.success(data.message || 'Restore completed successfully');

View File

@@ -152,7 +152,7 @@ export const AdminBackupMobileScreen: React.FC = () => {
);
const handleExecuteRestore = useCallback(() => {
if (!selectedBackup) return;
if (!selectedBackup || executeRestoreMutation.isPending) return;
executeRestoreMutation.mutate(
{ id: selectedBackup.id, options: { createSafetyBackup } },
{

View File

@@ -210,7 +210,7 @@ export const AdminBackupPage: React.FC = () => {
);
const handleExecuteRestore = useCallback(() => {
if (!selectedBackup) return;
if (!selectedBackup || executeRestoreMutation.isPending) return;
executeRestoreMutation.mutate(
{ id: selectedBackup.id, options: { createSafetyBackup } },
{