diff --git a/orion-visor-ui/src/components/app/navbar/index.vue b/orion-visor-ui/src/components/app/navbar/index.vue index 84c446bc..4b022356 100644 --- a/orion-visor-ui/src/components/app/navbar/index.vue +++ b/orion-visor-ui/src/components/app/navbar/index.vue @@ -331,7 +331,7 @@ // 查询未读消息 pullHasUnreadMessage(); // 注册未读消息轮询 - messageIntervalId.value = setInterval(pullHasUnreadMessage, 30000); + messageIntervalId.value = window.setInterval(pullHasUnreadMessage, 30000); }); onUnmounted(() => { diff --git a/orion-visor-ui/src/components/exec/log/panel/index.vue b/orion-visor-ui/src/components/exec/log/panel/index.vue index c6a31209..2375769a 100644 --- a/orion-visor-ui/src/components/exec/log/panel/index.vue +++ b/orion-visor-ui/src/components/exec/log/panel/index.vue @@ -69,7 +69,7 @@ // 等待一秒后先查询一下状态 setTimeout(pullExecStatus, 1000); // 注册状态轮询 - pullIntervalId.value = setInterval(pullExecStatus, 5000); + pullIntervalId.value = window.setInterval(pullExecStatus, 5000); } // 打开日志 nextTick(() => { diff --git a/orion-visor-ui/src/components/exec/log/panel/log-appender.ts b/orion-visor-ui/src/components/exec/log/panel/log-appender.ts index 45597e91..b00c0e79 100644 --- a/orion-visor-ui/src/components/exec/log/panel/log-appender.ts +++ b/orion-visor-ui/src/components/exec/log/panel/log-appender.ts @@ -172,11 +172,11 @@ export default class LogAppender implements ILogAppender { }; this.client.onmessage = this.processMessage.bind(this); // 注册持久化 - this.keepAliveTask = setInterval(() => { + this.keepAliveTask = window.setInterval(() => { if (this.client?.readyState === WebSocket.OPEN) { this.client?.send('p'); } - }, 15000) as unknown as number; + }, 15000); } // 打开日志 diff --git a/orion-visor-ui/src/components/system/uploader/file-uploader.ts b/orion-visor-ui/src/components/system/uploader/file-uploader.ts index c09b3c1f..aeb45cf9 100644 --- a/orion-visor-ui/src/components/system/uploader/file-uploader.ts +++ b/orion-visor-ui/src/components/system/uploader/file-uploader.ts @@ -2,6 +2,7 @@ import type { FileItem } from '@arco-design/web-vue'; import type { IFileUploader, ResponseMessageBody } from './const'; import { UploadOperatorType, UploadReceiverType } from './const'; import { openFileUploadChannel } from '@/api/system/upload'; +import { closeFileReader } from '@/utils/file'; // 512 KB export const PART_SIZE = 512 * 1024; @@ -81,13 +82,14 @@ export default class FileUploader implements IFileUploader { // 上传下一块数据 private async uploadNextPart() { + let reader = undefined as unknown as FileReader; try { if (this.currentPart < this.totalPart) { // 有下一个分片则上传 const start = this.currentPart++ * PART_SIZE; const end = Math.min(this.currentFile.size, start + PART_SIZE); const chunk = this.currentFile.slice(start, end); - const reader = new FileReader(); + reader = new FileReader(); // 读取数据 const arrayBuffer = await new Promise((resolve, reject) => { reader.onload = () => resolve(reader.result); @@ -107,11 +109,15 @@ export default class FileUploader implements IFileUploader { })); } } catch (e) { - // 读取文件失败 + // 发送读取文件失败 this.client?.send(JSON.stringify({ type: UploadOperatorType.ERROR, fileId: this.currentFileItem.uid, })); + // 释放资源 + if (reader) { + closeFileReader(reader); + } } } diff --git a/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue b/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue index ba334b8e..b3b9613b 100644 --- a/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue +++ b/orion-visor-ui/src/views/exec/batch-upload/components/upload-panel.vue @@ -278,7 +278,7 @@ // 设置轮询状态 onMounted(() => { - pullIntervalId.value = setInterval(pullTaskStatus, 5000); + pullIntervalId.value = window.setInterval(pullTaskStatus, 5000); }); // 卸载状态查询 diff --git a/orion-visor-ui/src/views/exec/exec-command-log/components/exec-command-log-table.vue b/orion-visor-ui/src/views/exec/exec-command-log/components/exec-command-log-table.vue index b5beea43..d1bd6bc7 100644 --- a/orion-visor-ui/src/views/exec/exec-command-log/components/exec-command-log-table.vue +++ b/orion-visor-ui/src/views/exec/exec-command-log/components/exec-command-log-table.vue @@ -429,7 +429,7 @@ // 加载数据 fetchTableData(); // 注册状态轮询 - pullIntervalId.value = setInterval(pullExecStatus, 10000); + pullIntervalId.value = window.setInterval(pullExecStatus, 10000); }); onUnmounted(() => { diff --git a/orion-visor-ui/src/views/exec/exec-job-log/components/exec-job-log-table.vue b/orion-visor-ui/src/views/exec/exec-job-log/components/exec-job-log-table.vue index 40bc2bc0..460f37f7 100644 --- a/orion-visor-ui/src/views/exec/exec-job-log/components/exec-job-log-table.vue +++ b/orion-visor-ui/src/views/exec/exec-job-log/components/exec-job-log-table.vue @@ -417,7 +417,7 @@ // 加载数据 fetchTableData(); // 注册状态轮询 - pullIntervalId.value = setInterval(pullJobStatus, 10000); + pullIntervalId.value = window.setInterval(pullJobStatus, 10000); }); onUnmounted(() => { diff --git a/orion-visor-ui/src/views/exec/upload-task/components/upload-task-table.vue b/orion-visor-ui/src/views/exec/upload-task/components/upload-task-table.vue index a9129fde..7a154336 100644 --- a/orion-visor-ui/src/views/exec/upload-task/components/upload-task-table.vue +++ b/orion-visor-ui/src/views/exec/upload-task/components/upload-task-table.vue @@ -324,7 +324,7 @@ // 加载数据 fetchTableData(); // 注册状态轮询 - pullIntervalId.value = setInterval(pullTaskStatus, 10000); + pullIntervalId.value = window.setInterval(pullTaskStatus, 10000); }); onUnmounted(() => { diff --git a/orion-visor-ui/src/views/terminal/service/session/terminal-session-manager.ts b/orion-visor-ui/src/views/terminal/service/session/terminal-session-manager.ts index 017fe9a8..78fa1d38 100644 --- a/orion-visor-ui/src/views/terminal/service/session/terminal-session-manager.ts +++ b/orion-visor-ui/src/views/terminal/service/session/terminal-session-manager.ts @@ -23,7 +23,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager { public sessions: Array; - private readonly keepAliveTaskId?: any; + private readonly keepAliveTaskId: number; private readonly dispatchFitFn: () => void; @@ -33,7 +33,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager { // 注册 resize 事件 addEventListen(window, 'resize', this.dispatchFitFn); // 注册 ping 事件 - this.keepAliveTaskId = setInterval(this.dispatchPing.bind(this), 15000); + this.keepAliveTaskId = window.setInterval(this.dispatchPing.bind(this), 15000); } // 打开 ssh 会话