History

Simplify runtime task execution flow in task runner

Rhys Sullivan committed 8 months ago

Commit 91ec1fe1 parent 6c01f0b1 file · +12 −14Browse files

Unified · Split

executor/packages/database/src/runtime/task_runner.ts+12−14
@@ -144,21 +144,19 @@ export async function runQueuedTask( · 143 unmodified lines
144 };144 };
145 }145 }
146 146
147 const runtimeResult = await (async () => {147 const adapter = new InProcessExecutionAdapter({
148 const adapter = new InProcessExecutionAdapter({148 runId: args.taskId,
149 runId: args.taskId,149 invokeTool: async (call) => await invokeTool(ctx, running, call),
150 invokeTool: async (call) => await invokeTool(ctx, running, call),150 });
151 });
152 151
153 return await runCodeWithAdapter(152 const runtimeResult = await runCodeWithAdapter(
154 {153 {
155 taskId: args.taskId,154 taskId: args.taskId,
156 code: running.code,155 code: running.code,
157 timeoutMs: running.timeoutMs,156 timeoutMs: running.timeoutMs,
158 },157 },
159 adapter,158 adapter,
160 );159 );
161 })();
162 160
163 const finished = await markTaskFinished(ctx, {161 const finished = await markTaskFinished(ctx, {
164 taskId: args.taskId,162 taskId: args.taskId,