Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement(pki-discovery): keep a slow background poll so newly started scans are detected

Claudef0ea7c47f69b
diff --git a/frontend/src/hooks/api/pkiDiscovery/queries.tsx b/frontend/src/hooks/api/pkiDiscovery/queries.tsx
index 7ab288f46b..373b95a542 100644
--- a/frontend/src/hooks/api/pkiDiscovery/queries.tsx
+++ b/frontend/src/hooks/api/pkiDiscovery/queries.tsx
@@ -44,6 +44,9 @@ export const pkiInstallationKeys = {
type TPollingOptions = { refetchInterval?: number | false };
const SCAN_IN_FLIGHT_POLL_MS = 5000;
+// Slow background poll while idle so a scan started elsewhere (scheduled auto-scan, or a
+// stale terminal status read from a replica right after triggering) is still picked up.
+const SCAN_IDLE_POLL_MS = 30000;
export const isPkiDiscoveryScanInFlight = (status?: PkiDiscoveryScanStatus | null) =>
status === PkiDiscoveryScanStatus.Pending || status === PkiDiscoveryScanStatus.Running;
@@ -86,7 +89,9 @@ export const useGetPkiDiscovery = ({ discoveryId }: TGetPkiDiscoveryDTO) => {
},
enabled: Boolean(discoveryId),
refetchInterval: (query) =>
- isPkiDiscoveryScanInFlight(query.state.data?.lastScanStatus) ? SCAN_IN_FLIGHT_POLL_MS : false
+ isPkiDiscoveryScanInFlight(query.state.data?.lastScanStatus)
+ ? SCAN_IN_FLIGHT_POLL_MS
+ : SCAN_IDLE_POLL_MS
});
};