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
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:
@@ -408,13 +408,23 @@ export const adminApi = {
|
|||||||
return response.data;
|
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 }> => {
|
restore: async (id: string, options?: ExecuteRestoreRequest): Promise<{ message: string }> => {
|
||||||
const response = await apiClient.post<{ message: string }>(
|
try {
|
||||||
`/admin/backups/${id}/restore`,
|
const response = await apiClient.post<{ message: string }>(
|
||||||
options
|
`/admin/backups/${id}/restore`,
|
||||||
);
|
options,
|
||||||
return response.data;
|
{ 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
|
// Schedules
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ export const useExecuteRestore = () => {
|
|||||||
return useMutation({
|
return useMutation({
|
||||||
mutationFn: ({ id, options }: { id: string; options?: ExecuteRestoreRequest }) =>
|
mutationFn: ({ id, options }: { id: string; options?: ExecuteRestoreRequest }) =>
|
||||||
adminApi.backups.restore(id, options),
|
adminApi.backups.restore(id, options),
|
||||||
|
retry: false,
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
queryClient.invalidateQueries({ queryKey: backupKeys.all });
|
queryClient.invalidateQueries({ queryKey: backupKeys.all });
|
||||||
toast.success(data.message || 'Restore completed successfully');
|
toast.success(data.message || 'Restore completed successfully');
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ export const AdminBackupMobileScreen: React.FC = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleExecuteRestore = useCallback(() => {
|
const handleExecuteRestore = useCallback(() => {
|
||||||
if (!selectedBackup) return;
|
if (!selectedBackup || executeRestoreMutation.isPending) return;
|
||||||
executeRestoreMutation.mutate(
|
executeRestoreMutation.mutate(
|
||||||
{ id: selectedBackup.id, options: { createSafetyBackup } },
|
{ id: selectedBackup.id, options: { createSafetyBackup } },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ export const AdminBackupPage: React.FC = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleExecuteRestore = useCallback(() => {
|
const handleExecuteRestore = useCallback(() => {
|
||||||
if (!selectedBackup) return;
|
if (!selectedBackup || executeRestoreMutation.isPending) return;
|
||||||
executeRestoreMutation.mutate(
|
executeRestoreMutation.mutate(
|
||||||
{ id: selectedBackup.id, options: { createSafetyBackup } },
|
{ id: selectedBackup.id, options: { createSafetyBackup } },
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user