Skip to content

Commit 94b2ddc

Browse files
authored
fix(scheduler): improve error handling in job flushing (#13587)
1 parent 25e075d commit 94b2ddc

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/runtime-core/src/scheduler.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,18 @@ export function queueJob(job: SchedulerJob): void {
114114
}
115115
}
116116

117+
const doFlushJobs = () => {
118+
try {
119+
flushJobs()
120+
} catch (e) {
121+
currentFlushPromise = null
122+
throw e
123+
}
124+
}
125+
117126
function queueFlush() {
118127
if (!currentFlushPromise) {
119-
currentFlushPromise = resolvedPromise.then(flushJobs).catch(e => {
120-
currentFlushPromise = null
121-
throw e
122-
})
128+
currentFlushPromise = resolvedPromise.then(doFlushJobs)
123129
}
124130
}
125131

0 commit comments

Comments
 (0)