mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-18 18:50:49 +08:00
Prevent overlapping log auto-refresh requests
This commit is contained in:
@@ -400,6 +400,8 @@ export function LogsPage() {
|
|||||||
startY: number;
|
startY: number;
|
||||||
fired: boolean;
|
fired: boolean;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
const logRequestInFlightRef = useRef(false);
|
||||||
|
const pendingFullReloadRef = useRef(false);
|
||||||
|
|
||||||
// 保存最新时间戳用于增量获取
|
// 保存最新时间戳用于增量获取
|
||||||
const latestTimestampRef = useRef<number>(0);
|
const latestTimestampRef = useRef<number>(0);
|
||||||
@@ -424,6 +426,15 @@ export function LogsPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logRequestInFlightRef.current) {
|
||||||
|
if (!incremental) {
|
||||||
|
pendingFullReloadRef.current = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logRequestInFlightRef.current = true;
|
||||||
|
|
||||||
if (!incremental) {
|
if (!incremental) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
}
|
}
|
||||||
@@ -474,6 +485,11 @@ export function LogsPage() {
|
|||||||
if (!incremental) {
|
if (!incremental) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
logRequestInFlightRef.current = false;
|
||||||
|
if (pendingFullReloadRef.current) {
|
||||||
|
pendingFullReloadRef.current = false;
|
||||||
|
void loadLogs(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user