mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-04 11:45:07 -05:00
clean up base 64 cache correctly
This commit is contained in:
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user