refactor(scheduler): simplify checkRecursiveUpdates (#11856)

This commit is contained in:
Yang Mingshan 2024-09-10 15:51:10 +08:00 committed by GitHub
parent f80d447c17
commit 48613bb928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 22 deletions

View File

@ -267,10 +267,7 @@ function flushJobs(seen?: CountMap) {
}
function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) {
if (!seen.has(fn)) {
seen.set(fn, 1)
} else {
const count = seen.get(fn)!
const count = seen.get(fn) || 0
if (count > RECURSION_LIMIT) {
const instance = fn.i
const componentName = instance && getComponentName(instance.type)
@ -286,8 +283,7 @@ function checkRecursiveUpdates(seen: CountMap, fn: SchedulerJob) {
ErrorCodes.APP_ERROR_HANDLER,
)
return true
} else {
}
seen.set(fn, count + 1)
}
}
return false
}