Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (backups): Do not reload backups if request already in progress

Rostislav Dugin349e7f0ee870
diff --git a/frontend/src/features/backups/ui/BackupsComponent.tsx b/frontend/src/features/backups/ui/BackupsComponent.tsx
index cc6b8f00..d8701ca4 100644
--- a/frontend/src/features/backups/ui/BackupsComponent.tsx
+++ b/frontend/src/features/backups/ui/BackupsComponent.tsx
@@ -57,6 +57,7 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef
const [showingRestoresBackupId, setShowingRestoresBackupId] = useState<string | undefined>();
const lastRequestTimeRef = useRef<number>(0);
+ const isBackupsRequestInFlightRef = useRef(false);
const [downloadingBackupId, setDownloadingBackupId] = useState<string | undefined>();
const [cancellingBackupId, setCancellingBackupId] = useState<string | undefined>();
@@ -72,6 +73,9 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef
};
const loadBackups = async (limit?: number) => {
+ if (isBackupsRequestInFlightRef.current) return;
+ isBackupsRequestInFlightRef.current = true;
+
const requestTime = Date.now();
lastRequestTimeRef.current = requestTime;
@@ -89,6 +93,8 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef
if (lastRequestTimeRef.current === requestTime) {
alert((e as Error).message);
}
+ } finally {
+ isBackupsRequestInFlightRef.current = false;
}
};