mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-05 08:42:35 +08:00
fix: Fix dashboard refresh exception issue (#9429)
This commit is contained in:
parent
3f26412585
commit
997b706d8a
1 changed files with 12 additions and 7 deletions
|
|
@ -279,6 +279,7 @@ let timer: NodeJS.Timer | null = null;
|
||||||
let isInit = ref<boolean>(true);
|
let isInit = ref<boolean>(true);
|
||||||
let isStatusInit = ref<boolean>(true);
|
let isStatusInit = ref<boolean>(true);
|
||||||
let isActive = ref(true);
|
let isActive = ref(true);
|
||||||
|
let isCurrentActive = ref(true);
|
||||||
|
|
||||||
const ioReadBytes = ref<Array<number>>([]);
|
const ioReadBytes = ref<Array<number>>([]);
|
||||||
const ioWriteBytes = ref<Array<number>>([]);
|
const ioWriteBytes = ref<Array<number>>([]);
|
||||||
|
|
@ -406,16 +407,19 @@ const onLoadBaseInfo = async (isInit: boolean, range: string) => {
|
||||||
statusRef.value?.acceptParams(currentInfo.value, baseInfo.value);
|
statusRef.value?.acceptParams(currentInfo.value, baseInfo.value);
|
||||||
appRef.value?.acceptParams();
|
appRef.value?.acceptParams();
|
||||||
if (isInit) {
|
if (isInit) {
|
||||||
try {
|
timer = setInterval(async () => {
|
||||||
timer = setInterval(async () => {
|
try {
|
||||||
|
if (!isCurrentActive.value) {
|
||||||
|
throw new Error('jump out');
|
||||||
|
}
|
||||||
if (isActive.value && !globalStore.isOnRestart) {
|
if (isActive.value && !globalStore.isOnRestart) {
|
||||||
await onLoadCurrentInfo();
|
await onLoadCurrentInfo();
|
||||||
}
|
}
|
||||||
}, 3000);
|
} catch {
|
||||||
} finally {
|
clearInterval(Number(timer));
|
||||||
clearInterval(Number(timer));
|
timer = null;
|
||||||
timer = null;
|
}
|
||||||
}
|
}, 3000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -554,6 +558,7 @@ onMounted(() => {
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
window.removeEventListener('focus', onFocus);
|
window.removeEventListener('focus', onFocus);
|
||||||
window.removeEventListener('blur', onBlur);
|
window.removeEventListener('blur', onBlur);
|
||||||
|
isCurrentActive.value = false;
|
||||||
clearInterval(Number(timer));
|
clearInterval(Number(timer));
|
||||||
timer = null;
|
timer = null;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue