From 7b75f156b46cdb381288b1481cf64f499017bb0e Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Wed, 4 Feb 2026 01:01:49 -0800 Subject: [PATCH] clean up base 64 cache correctly --- apps/sim/app/api/workflows/[id]/execute/route.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/sim/app/api/workflows/[id]/execute/route.ts b/apps/sim/app/api/workflows/[id]/execute/route.ts index bab17d588..e9fc6d073 100644 --- a/apps/sim/app/api/workflows/[id]/execute/route.ts +++ b/apps/sim/app/api/workflows/[id]/execute/route.ts @@ -596,6 +596,8 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: } } + const shouldCleanupBase64 = true + try { const startTime = new Date() @@ -866,9 +868,6 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: endTime: result.metadata?.endTime || new Date().toISOString(), }, }) - - // Cleanup base64 cache for this execution - await cleanupExecutionBase64Cache(executionId) } catch (error: unknown) { const isTimeout = isTimeoutError(error) || timeoutController.isTimedOut() const errorMessage = isTimeout @@ -902,6 +901,9 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: }) } finally { timeoutController.cleanup() + if (executionId && shouldCleanupBase64) { + await cleanupExecutionBase64Cache(executionId) + } if (!isStreamClosed) { try { controller.enqueue(encoder.encode('data: [DONE]\n\n'))