fix(scheduler): improve error handling in job flushing (#13587)

This commit is contained in:
edison 2025-07-09 08:44:24 +08:00 committed by GitHub
parent 25e075d967
commit 94b2ddc6f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 4 deletions

View File

@ -114,12 +114,18 @@ export function queueJob(job: SchedulerJob): void {
} }
} }
function queueFlush() { const doFlushJobs = () => {
if (!currentFlushPromise) { try {
currentFlushPromise = resolvedPromise.then(flushJobs).catch(e => { flushJobs()
} catch (e) {
currentFlushPromise = null currentFlushPromise = null
throw e throw e
}) }
}
function queueFlush() {
if (!currentFlushPromise) {
currentFlushPromise = resolvedPromise.then(doFlushJobs)
} }
} }