mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 17:27:09 +00:00
perf(aws-lambda): warm the audio function while the plan runs (#6148)
* perf(aws-lambda): warm the audio function while the plan runs The audio task runs on the x86 render function, which is cold when the plan ran on the arm64 video function. A fire-and-forget invoke at the start of a render now wakes it, so the audio no longer outlasts the chunks. * perf(aws-lambda): warm the render function only on a stack with a video function An x86-only stack has no cold function to warm, so it takes the old path with no extra step. The CDK stack has no video function and is unchanged. * perf(aws-lambda): wrap a template comment * style(aws-lambda): format the warm-up template test
This commit is contained in:
@@ -254,6 +254,11 @@ Resources:
|
||||
SelectPlanProtocol:
|
||||
Type: Choice
|
||||
Choices:
|
||||
# Only a stack with the arm64 video function has a cold x86 function to warm.
|
||||
# Without one the compared value can never match.
|
||||
- Variable: $.PlanProtocol
|
||||
StringEquals: !If [HasVideoFunction, v2, v2-without-video-function]
|
||||
Next: WarmRender
|
||||
- Variable: $.PlanProtocol
|
||||
StringEquals: v2
|
||||
Next: PlanV2
|
||||
@@ -265,6 +270,23 @@ Resources:
|
||||
Next: UnsupportedPlanProtocol
|
||||
Default: PlanV2
|
||||
|
||||
# The audio task runs on this function once the plan is done; starting its container now hides the cold start.
|
||||
WarmRender:
|
||||
Type: Task
|
||||
Resource: arn:aws:states:::lambda:invoke
|
||||
Parameters:
|
||||
FunctionName: !GetAtt RenderFunction.Arn
|
||||
InvocationType: Event
|
||||
Payload:
|
||||
Action: warm
|
||||
ResultPath: null
|
||||
Catch:
|
||||
- ErrorEquals:
|
||||
- States.ALL
|
||||
ResultPath: null
|
||||
Next: PlanV2
|
||||
Next: PlanV2
|
||||
|
||||
UnsupportedPlanProtocol:
|
||||
Type: Fail
|
||||
Error: PLAN_PROTOCOL_UNSUPPORTED
|
||||
|
||||
Reference in New Issue
Block a user