Add LandSAR cluster worker deployment
This commit is contained in:
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef } from 'react';
|
||||
import apiClient from '../api/client';
|
||||
import { getHealth } from '../api/health';
|
||||
|
||||
const HEALTH_POLL_INTERVAL_MS = 30000;
|
||||
const HEALTH_POLL_INTERVAL_MS = 5 * 60 * 1000;
|
||||
const STARTUP_RETRY_DELAYS_MS = [750, 1500, 3000];
|
||||
|
||||
const sleep = (delayMs) => new Promise((resolve) => setTimeout(resolve, delayMs));
|
||||
@@ -95,6 +95,8 @@ export default function useAppAuthLifecycle({
|
||||
if (userFromLogin) {
|
||||
setCurrentUser(userFromLogin);
|
||||
setAuthChecked(true);
|
||||
void fetchCurrentUser({ clearOnFailure: false });
|
||||
return;
|
||||
}
|
||||
await fetchCurrentUser({ clearOnFailure: !userFromLogin });
|
||||
}, [fetchCurrentUser, setCurrentUser, setAuthChecked]);
|
||||
@@ -236,11 +238,16 @@ export default function useAppAuthLifecycle({
|
||||
}, [fetchCurrentUser, fetchLicenseStatus]);
|
||||
|
||||
useEffect(() => {
|
||||
void fetchHealthStatus();
|
||||
const startupTimer = setTimeout(() => {
|
||||
void fetchHealthStatus({ silent: true });
|
||||
}, 1500);
|
||||
const interval = setInterval(() => {
|
||||
void fetchHealthStatus({ silent: true });
|
||||
}, HEALTH_POLL_INTERVAL_MS);
|
||||
return () => clearInterval(interval);
|
||||
return () => {
|
||||
clearTimeout(startupTimer);
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, [fetchHealthStatus]);
|
||||
|
||||
return {
|
||||
|
||||
@@ -2,6 +2,8 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import apiClient from '../api/client';
|
||||
import { normalizeTaskStatus } from '../utils/appUiHelpers';
|
||||
|
||||
const ACTIVE_TASK_FALLBACK_POLL_MS = 10000;
|
||||
|
||||
export default function useGlobalTaskControl({
|
||||
currentUser,
|
||||
licenseOk,
|
||||
@@ -135,7 +137,7 @@ export default function useGlobalTaskControl({
|
||||
es.close();
|
||||
es = null;
|
||||
if (!fallbackInterval) {
|
||||
fallbackInterval = setInterval(syncActiveTasks, 5000);
|
||||
fallbackInterval = setInterval(syncActiveTasks, ACTIVE_TASK_FALLBACK_POLL_MS);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { clamp } from '../utils/appUiHelpers';
|
||||
|
||||
export default function usePanelResize({
|
||||
isResizing,
|
||||
setIsResizing,
|
||||
leftPanelWidth,
|
||||
rightPanelWidth,
|
||||
setLeftPanelWidth,
|
||||
setRightPanelWidth,
|
||||
resizeStateRef,
|
||||
}) {
|
||||
const startResize = useCallback((side, event) => {
|
||||
event.preventDefault();
|
||||
resizeStateRef.current = {
|
||||
side,
|
||||
startX: event.clientX,
|
||||
startLeft: leftPanelWidth,
|
||||
startRight: rightPanelWidth,
|
||||
};
|
||||
setIsResizing(true);
|
||||
}, [resizeStateRef, leftPanelWidth, rightPanelWidth, setIsResizing]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isResizing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const handleMove = (event) => {
|
||||
const { side, startX, startLeft, startRight } = resizeStateRef.current;
|
||||
const delta = event.clientX - startX;
|
||||
|
||||
if (side === 'left') {
|
||||
setLeftPanelWidth(clamp(startLeft + delta, 320, 620));
|
||||
} else if (side === 'right') {
|
||||
setRightPanelWidth(clamp(startRight - delta, 280, 560));
|
||||
}
|
||||
};
|
||||
|
||||
const handleUp = () => {
|
||||
setIsResizing(false);
|
||||
};
|
||||
|
||||
window.addEventListener('mousemove', handleMove);
|
||||
window.addEventListener('mouseup', handleUp);
|
||||
return () => {
|
||||
window.removeEventListener('mousemove', handleMove);
|
||||
window.removeEventListener('mouseup', handleUp);
|
||||
};
|
||||
}, [isResizing, resizeStateRef, setLeftPanelWidth, setRightPanelWidth, setIsResizing]);
|
||||
|
||||
return {
|
||||
startResize,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user