diff --git a/libs/horizon/src/renderer/taskExecutor/BrowserAsync.ts b/libs/horizon/src/renderer/taskExecutor/BrowserAsync.ts index 2aeead9f..6da28613 100644 --- a/libs/horizon/src/renderer/taskExecutor/BrowserAsync.ts +++ b/libs/horizon/src/renderer/taskExecutor/BrowserAsync.ts @@ -23,6 +23,10 @@ let port1 = null; let port2 = null; let isTestRuntime = false; +export function isOverTime() { + return false; +} + // 1、设置deadline;2、回调TaskExecutor传过来的browserCallback const callRenderTasks = () => { if (browserCallback === null) { diff --git a/libs/horizon/src/renderer/taskExecutor/TaskExecutor.ts b/libs/horizon/src/renderer/taskExecutor/TaskExecutor.ts index ac5ce9b3..8613cfca 100644 --- a/libs/horizon/src/renderer/taskExecutor/TaskExecutor.ts +++ b/libs/horizon/src/renderer/taskExecutor/TaskExecutor.ts @@ -18,7 +18,7 @@ */ import { Node } from '../taskExecutor/TaskQueue'; -import { requestBrowserCallback } from './BrowserAsync'; +import { requestBrowserCallback, isOverTime } from './BrowserAsync'; import { add, shift, first, remove } from './TaskQueue'; @@ -44,6 +44,11 @@ function callTasks() { // 循环执行task while (task !== null) { + if (isOverTime()) { + // 超过了deadline + break; + } + const callback = task.callback; if (callback !== null) { task.callback = null;