Skip to content

Commit 1fb7f69

Browse files
taochaoquan-boschChaoquanTao
authored andcommitted
[17025][ui] optimize queryLog to avoid infinite recursive
1 parent 0a6819a commit 1fb7f69

File tree

3 files changed

+13
-56
lines changed

3 files changed

+13
-56
lines changed

dolphinscheduler-ui/src/views/projects/task/instance/batch-task.tsx

+4-21
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ import totalCount from '@/utils/tableTotalCount'
4646
const BatchTaskInstance = defineComponent({
4747
name: 'task-instance',
4848
setup() {
49-
const uiSettingStore = useUISettingStore()
50-
const logTimer = uiSettingStore.getLogTimer
5149
const { t, variables, getTableData, createColumns } = useTable()
5250

5351
const requestTableData = () => {
@@ -114,9 +112,7 @@ const BatchTaskInstance = defineComponent({
114112
variables.showModalRef = false
115113
}
116114

117-
let getLogsID: number
118-
119-
const getLogs = (row: any, logTimer: number) => {
115+
const getLogs = (row: any) => {
120116
const { state } = useAsyncState(
121117
queryLog({
122118
taskInstanceId: Number(row.id),
@@ -125,23 +121,10 @@ const BatchTaskInstance = defineComponent({
125121
}).then((res: any) => {
126122
variables.logRef += res.message || ''
127123
if (res && res.message !== '') {
128-
variables.limit += 1000
129124
variables.skipLineNum += res.lineNum
130-
getLogs(row, logTimer)
125+
getLogs(row)
131126
} else {
132127
variables.logLoadingRef = false
133-
if (logTimer !== 0) {
134-
if (typeof getLogsID === 'number') {
135-
clearTimeout(getLogsID)
136-
}
137-
getLogsID = setTimeout(() => {
138-
variables.logRef = ''
139-
variables.limit = 1000
140-
variables.skipLineNum = 0
141-
variables.logLoadingRef = true
142-
getLogs(row, logTimer)
143-
}, logTimer * 1000)
144-
}
145128
}
146129
}),
147130
{}
@@ -154,7 +137,7 @@ const BatchTaskInstance = defineComponent({
154137
variables.logRef = ''
155138
variables.limit = 1000
156139
variables.skipLineNum = 0
157-
getLogs(row, logTimer)
140+
getLogs(row)
158141
}
159142

160143
const trim = getCurrentInstance()?.appContext.config.globalProperties.trim
@@ -172,7 +155,7 @@ const BatchTaskInstance = defineComponent({
172155
() => variables.showModalRef,
173156
() => {
174157
if (variables.showModalRef) {
175-
getLogs(variables.row, logTimer)
158+
getLogs(variables.row)
176159
} else {
177160
variables.row = {}
178161
variables.logRef = ''

dolphinscheduler-ui/src/views/projects/task/instance/stream-task.tsx

+4-14
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ const BatchTaskInstance = defineComponent({
4848
name: 'task-instance',
4949
setup() {
5050
let setIntervalP: number
51-
const uiSettingStore = useUISettingStore()
52-
const logTimer = uiSettingStore.getLogTimer
5351
const { t, variables, getTableData, createColumns } = useTable()
5452

5553
const onUpdatePageSize = () => {
@@ -96,7 +94,7 @@ const BatchTaskInstance = defineComponent({
9694
variables.showModalRef = false
9795
}
9896

99-
const getLogs = (row: any, logTimer: number) => {
97+
const getLogs = (row: any) => {
10098
const { state } = useAsyncState(
10199
queryLog({
102100
taskInstanceId: Number(row.id),
@@ -105,18 +103,10 @@ const BatchTaskInstance = defineComponent({
105103
}).then((res: any) => {
106104
variables.logRef += res.message || ''
107105
if (res && res.message !== '') {
108-
variables.limit += 1000
109106
variables.skipLineNum += res.lineNum
110-
getLogs(row, logTimer)
107+
getLogs(row)
111108
} else {
112109
variables.logLoadingRef = false
113-
setTimeout(() => {
114-
variables.logRef = ''
115-
variables.limit = 1000
116-
variables.skipLineNum = 0
117-
variables.logLoadingRef = true
118-
getLogs(row, logTimer)
119-
}, logTimer * 1000)
120110
}
121111
}),
122112
{}
@@ -129,7 +119,7 @@ const BatchTaskInstance = defineComponent({
129119
variables.logRef = ''
130120
variables.limit = 1000
131121
variables.skipLineNum = 0
132-
getLogs(row, logTimer)
122+
getLogs(row)
133123
}
134124

135125
const trim = getCurrentInstance()?.appContext.config.globalProperties.trim
@@ -154,7 +144,7 @@ const BatchTaskInstance = defineComponent({
154144
() => variables.showModalRef,
155145
() => {
156146
if (variables.showModalRef) {
157-
getLogs(variables.row, logTimer)
147+
getLogs(variables.row)
158148
} else {
159149
variables.row = {}
160150
variables.logRef = ''

dolphinscheduler-ui/src/views/projects/workflow/components/dag/index.tsx

+5-21
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ export default defineComponent({
8888
const route = useRoute()
8989
const theme = useThemeStore()
9090

91-
const uiSettingStore = useUISettingStore()
92-
const logTimer = uiSettingStore.getLogTimer
93-
9491
// Whether the graph can be operated
9592
provide('readonly', toRef(props, 'readonly'))
9693

@@ -246,12 +243,10 @@ export default defineComponent({
246243
taskModalVisible.value = false
247244
viewLog(taskId, taskType)
248245

249-
getLogs(logTimer)
246+
getLogs()
250247
}
251248

252-
let getLogsID: number
253-
254-
const getLogs = (logTimer: number) => {
249+
const getLogs = () => {
255250
const { state } = useAsyncState(
256251
queryLog({
257252
taskInstanceId: nodeVariables.logTaskId,
@@ -260,21 +255,10 @@ export default defineComponent({
260255
}).then((res: any) => {
261256
nodeVariables.logRef += res.message || ''
262257
if (res && res.message !== '') {
263-
nodeVariables.limit += 1000
264258
nodeVariables.skipLineNum += res.lineNum
265-
getLogs(logTimer)
259+
getLogs()
266260
} else {
267261
nodeVariables.logLoadingRef = false
268-
if (logTimer !== 0) {
269-
if (typeof getLogsID === 'number') {
270-
clearTimeout(getLogsID)
271-
}
272-
getLogsID = setTimeout(() => {
273-
nodeVariables.limit += 1000
274-
nodeVariables.skipLineNum += 1000
275-
getLogs(logTimer)
276-
}, logTimer * 1000)
277-
}
278262
}
279263
}),
280264
{}
@@ -283,11 +267,11 @@ export default defineComponent({
283267
return state
284268
}
285269

286-
const refreshLogs = (logTimer: number) => {
270+
const refreshLogs = () => {
287271
nodeVariables.logRef = ''
288272
nodeVariables.limit = 1000
289273
nodeVariables.skipLineNum = 0
290-
getLogs(logTimer)
274+
getLogs()
291275
}
292276

293277
const handleExecuteTask = (

0 commit comments

Comments
 (0)