web: reduce polling interval
The operations will usually take half a second.
This commit is contained in:
parent
c6ebe5a360
commit
1ff1cae709
@ -19,12 +19,12 @@ interface Operation {
|
||||
export default function OperationStatusPage() {
|
||||
const router = useRouter();
|
||||
const { operationId } = useParams();
|
||||
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [operation, setOperation] = useState<Operation | null>(null);
|
||||
|
||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!operationId) return;
|
||||
@ -55,7 +55,7 @@ export default function OperationStatusPage() {
|
||||
|
||||
fetchOperation();
|
||||
if (!intervalRef.current) {
|
||||
intervalRef.current = setInterval(fetchOperation, 5000);
|
||||
intervalRef.current = setInterval(fetchOperation, 1000);
|
||||
}
|
||||
|
||||
return () => {
|
||||
@ -77,9 +77,9 @@ export default function OperationStatusPage() {
|
||||
return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusClass = (status: number) => getStatusText(status).toLowerCase();
|
||||
|
||||
|
||||
const getStatusClass = (status: number) => getStatusText(status).toLowerCase();
|
||||
|
||||
return (
|
||||
<Webpage>
|
||||
<main className="operation-status">
|
||||
@ -99,7 +99,7 @@ export default function OperationStatusPage() {
|
||||
<Typography>Owner: {operation.Owner}</Typography>
|
||||
<Typography>Date: {new Date(operation.Date * 1000).toLocaleString()}</Typography>
|
||||
<Typography>Path: {operation.Path}</Typography>
|
||||
|
||||
|
||||
{operation.Status === 1 && (
|
||||
<div className="submission-button">
|
||||
<Button
|
||||
@ -119,4 +119,4 @@ export default function OperationStatusPage() {
|
||||
</main>
|
||||
</Webpage>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user