Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Run resolved-props cleanup task always

Jonny Burger4bdcae260d41
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 623529186b..78c8d2e58a 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -427,18 +427,8 @@ export const launchHandler = async (
cleanupTasks.push(task);
};
- const onTimeout = async () => {
- RenderInternals.Log.error(
- {indent: false, logLevel: params.logLevel},
- 'Function is about to time out. Can not finish render.',
- );
-
- // @ts-expect-error
- (globalThis._dumpUnreleasedBuffers as EventEmitter).emit(
- 'dump-unreleased-buffers',
- );
-
- Promise.all(cleanupTasks)
+ const runCleanupTasks = () => {
+ const prom = Promise.all(cleanupTasks)
.then(() => {
RenderInternals.Log.info(
{indent: false, logLevel: params.logLevel},
@@ -453,6 +443,23 @@ export const launchHandler = async (
);
});
+ cleanupTasks.length = 0;
+ return prom;
+ };
+
+ const onTimeout = async () => {
+ RenderInternals.Log.error(
+ {indent: false, logLevel: params.logLevel},
+ 'Function is about to time out. Can not finish render.',
+ );
+
+ // @ts-expect-error
+ (globalThis._dumpUnreleasedBuffers as EventEmitter).emit(
+ 'dump-unreleased-buffers',
+ );
+
+ runCleanupTasks();
+
if (!params.webhook) {
RenderInternals.Log.verbose(
{
@@ -622,6 +629,8 @@ export const launchHandler = async (
);
}
+ runCleanupTasks();
+
return {
type: 'success',
};
@@ -650,6 +659,8 @@ export const launchHandler = async (
});
await overallProgress.upload();
+ runCleanupTasks();
+
RenderInternals.Log.error(
{indent: false, logLevel: params.logLevel},
'Wrote error to S3',