This is an automated email from the ASF dual-hosted git repository.
zihaoxiang pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 8b8c5fe9bf [Improvement-17025][UI] optimize queryLog to avoid infinite
recursive invoke (#17029)
8b8c5fe9bf is described below
commit 8b8c5fe9bf7d9edb64b258ba54f69f3603c0fdbc
Author: Terry Tao <[email protected]>
AuthorDate: Wed Nov 26 12:26:09 2025 +0800
[Improvement-17025][UI] optimize queryLog to avoid infinite recursive
invoke (#17029)
---
.../views/projects/task/instance/batch-task.tsx | 26 ++++-----------------
.../views/projects/task/instance/stream-task.tsx | 19 ++++-----------
.../projects/workflow/components/dag/index.tsx | 27 ++++------------------
3 files changed, 13 insertions(+), 59 deletions(-)
diff --git
a/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx
b/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx
index 8ee924fe23..6f6626d758 100644
--- a/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx
+++ b/dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx
@@ -38,7 +38,6 @@ import { useI18n } from 'vue-i18n'
import { useAsyncState } from '@vueuse/core'
import { queryLog } from '@/service/modules/log'
import { stateType } from '@/common/common'
-import { useUISettingStore } from '@/store/ui-setting/ui-setting'
import Card from '@/components/card'
import LogModal from '@/components/log-modal'
import totalCount from '@/utils/tableTotalCount'
@@ -46,8 +45,6 @@ import totalCount from '@/utils/tableTotalCount'
const BatchTaskInstance = defineComponent({
name: 'task-instance',
setup() {
- const uiSettingStore = useUISettingStore()
- const logTimer = uiSettingStore.getLogTimer
const { t, variables, getTableData, createColumns } = useTable()
const requestTableData = () => {
@@ -114,9 +111,7 @@ const BatchTaskInstance = defineComponent({
variables.showModalRef = false
}
- let getLogsID: number
-
- const getLogs = (row: any, logTimer: number) => {
+ const getLogs = (row: any) => {
const { state } = useAsyncState(
queryLog({
taskInstanceId: Number(row.id),
@@ -125,23 +120,10 @@ const BatchTaskInstance = defineComponent({
}).then((res: any) => {
variables.logRef += res.message || ''
if (res && res.message !== '') {
- variables.limit += 1000
variables.skipLineNum += res.lineNum
- getLogs(row, logTimer)
+ getLogs(row)
} else {
variables.logLoadingRef = false
- if (logTimer !== 0) {
- if (typeof getLogsID === 'number') {
- clearTimeout(getLogsID)
- }
- getLogsID = setTimeout(() => {
- variables.logRef = ''
- variables.limit = 1000
- variables.skipLineNum = 0
- variables.logLoadingRef = true
- getLogs(row, logTimer)
- }, logTimer * 1000)
- }
}
}),
{}
@@ -154,7 +136,7 @@ const BatchTaskInstance = defineComponent({
variables.logRef = ''
variables.limit = 1000
variables.skipLineNum = 0
- getLogs(row, logTimer)
+ getLogs(row)
}
const trim = getCurrentInstance()?.appContext.config.globalProperties.trim
@@ -172,7 +154,7 @@ const BatchTaskInstance = defineComponent({
() => variables.showModalRef,
() => {
if (variables.showModalRef) {
- getLogs(variables.row, logTimer)
+ getLogs(variables.row)
} else {
variables.row = {}
variables.logRef = ''
diff --git
a/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx
b/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx
index 9441185259..5fd162e137 100644
--- a/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx
+++ b/dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx
@@ -39,7 +39,6 @@ import { useI18n } from 'vue-i18n'
import { useAsyncState } from '@vueuse/core'
import { queryLog } from '@/service/modules/log'
import { streamStateType } from '@/common/common'
-import { useUISettingStore } from '@/store/ui-setting/ui-setting'
import Card from '@/components/card'
import LogModal from '@/components/log-modal'
import totalCount from '@/utils/tableTotalCount'
@@ -48,8 +47,6 @@ const BatchTaskInstance = defineComponent({
name: 'task-instance',
setup() {
let setIntervalP: number
- const uiSettingStore = useUISettingStore()
- const logTimer = uiSettingStore.getLogTimer
const { t, variables, getTableData, createColumns } = useTable()
const onUpdatePageSize = () => {
@@ -96,7 +93,7 @@ const BatchTaskInstance = defineComponent({
variables.showModalRef = false
}
- const getLogs = (row: any, logTimer: number) => {
+ const getLogs = (row: any) => {
const { state } = useAsyncState(
queryLog({
taskInstanceId: Number(row.id),
@@ -105,18 +102,10 @@ const BatchTaskInstance = defineComponent({
}).then((res: any) => {
variables.logRef += res.message || ''
if (res && res.message !== '') {
- variables.limit += 1000
variables.skipLineNum += res.lineNum
- getLogs(row, logTimer)
+ getLogs(row)
} else {
variables.logLoadingRef = false
- setTimeout(() => {
- variables.logRef = ''
- variables.limit = 1000
- variables.skipLineNum = 0
- variables.logLoadingRef = true
- getLogs(row, logTimer)
- }, logTimer * 1000)
}
}),
{}
@@ -129,7 +118,7 @@ const BatchTaskInstance = defineComponent({
variables.logRef = ''
variables.limit = 1000
variables.skipLineNum = 0
- getLogs(row, logTimer)
+ getLogs(row)
}
const trim = getCurrentInstance()?.appContext.config.globalProperties.trim
@@ -154,7 +143,7 @@ const BatchTaskInstance = defineComponent({
() => variables.showModalRef,
() => {
if (variables.showModalRef) {
- getLogs(variables.row, logTimer)
+ getLogs(variables.row)
} else {
variables.row = {}
variables.logRef = ''
diff --git
a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx
b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx
index c04cd5de65..52db69407d 100644
--- a/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx
+++ b/dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx
@@ -55,7 +55,6 @@ import './x6-style.scss'
import { queryLog } from '@/service/modules/log'
import { useAsyncState } from '@vueuse/core'
import utils from '@/utils'
-import { useUISettingStore } from '@/store/ui-setting/ui-setting'
import { executeTask } from '@/service/modules/executors'
import DependenciesModal from
'@/views/projects/components/dependencies/dependencies-modal'
@@ -88,9 +87,6 @@ export default defineComponent({
const route = useRoute()
const theme = useThemeStore()
- const uiSettingStore = useUISettingStore()
- const logTimer = uiSettingStore.getLogTimer
-
// Whether the graph can be operated
provide('readonly', toRef(props, 'readonly'))
@@ -246,12 +242,10 @@ export default defineComponent({
taskModalVisible.value = false
viewLog(taskId, taskType)
- getLogs(logTimer)
+ getLogs()
}
- let getLogsID: number
-
- const getLogs = (logTimer: number) => {
+ const getLogs = () => {
const { state } = useAsyncState(
queryLog({
taskInstanceId: nodeVariables.logTaskId,
@@ -260,21 +254,10 @@ export default defineComponent({
}).then((res: any) => {
nodeVariables.logRef += res.message || ''
if (res && res.message !== '') {
- nodeVariables.limit += 1000
nodeVariables.skipLineNum += res.lineNum
- getLogs(logTimer)
+ getLogs()
} else {
nodeVariables.logLoadingRef = false
- if (logTimer !== 0) {
- if (typeof getLogsID === 'number') {
- clearTimeout(getLogsID)
- }
- getLogsID = setTimeout(() => {
- nodeVariables.limit += 1000
- nodeVariables.skipLineNum += 1000
- getLogs(logTimer)
- }, logTimer * 1000)
- }
}
}),
{}
@@ -283,11 +266,11 @@ export default defineComponent({
return state
}
- const refreshLogs = (logTimer: number) => {
+ const refreshLogs = () => {
nodeVariables.logRef = ''
nodeVariables.limit = 1000
nodeVariables.skipLineNum = 0
- getLogs(logTimer)
+ getLogs()
}
const handleExecuteTask = (