s
This commit is contained in:
@@ -89,6 +89,8 @@ export function LiveProcessLiveLogCard({
|
||||
const outRef = useRef<HTMLPreElement>(null);
|
||||
const errRef = useRef<HTMLPreElement>(null);
|
||||
const prevOnlineRef = useRef(false);
|
||||
const pullInFlightRef = useRef(false);
|
||||
const pullQueuedRef = useRef(false);
|
||||
|
||||
const douyinHints = extractDouyinRoomHints(urlListText);
|
||||
const onlineNow = /^(online|running)$/i.test(processStatus);
|
||||
@@ -99,6 +101,11 @@ export function LiveProcessLiveLogCard({
|
||||
|
||||
const pull = useCallback(async () => {
|
||||
if (!currentProc) return;
|
||||
if (pullInFlightRef.current) {
|
||||
pullQueuedRef.current = true;
|
||||
return;
|
||||
}
|
||||
pullInFlightRef.current = true;
|
||||
try {
|
||||
const data = await fetchJson<StatusPayload>(
|
||||
`/status?process=${encodeURIComponent(currentProc)}`,
|
||||
@@ -125,6 +132,12 @@ export function LiveProcessLiveLogCard({
|
||||
setBusinessNote("");
|
||||
setFfmpegPids([]);
|
||||
setLogAgeSeconds(null);
|
||||
} finally {
|
||||
pullInFlightRef.current = false;
|
||||
if (pullQueuedRef.current) {
|
||||
pullQueuedRef.current = false;
|
||||
window.setTimeout(() => void pull(), 0);
|
||||
}
|
||||
}
|
||||
}, [currentProc, fetchJson]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user