Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-805 Fix web context initialization during snapstart #814

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

olegz
Copy link
Collaborator

@olegz olegz commented Mar 26, 2024

#805

Also updated to s-c-function-serverless-webb 4.1.1-SNAPSHOT This commit forces wait for full context initialization if context is created during snapstart creation

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

Also updated to s-c-function-serverless-webb 4.1.1-SNAPSHOT
This commit forces wait for full context initialization if context is created during snapstart creation
@@ -53,6 +53,10 @@ public SpringDelegatingLambdaContainerHandler() {
public SpringDelegatingLambdaContainerHandler(Class<?>... startupClasses) {
this.startupClasses = startupClasses;
this.mvc = ServerlessMVC.INSTANCE(this.startupClasses);
if (System.getenv().containsKey("AWS_LAMBDA_INITIALIZATION_TYPE")
&& System.getenv().get("AWS_LAMBDA_INITIALIZATION_TYPE").equals("snap-start")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't that be !"on-demand" to cover "provisioned-concurrency" as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, although I am not quite sure what 'on-demand' is

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you can change s-c-function version from snapshot to 4.1.1 as we just had a release

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See: https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime

AWS_LAMBDA_INITIALIZATION_TYPE – The initialization type of the function, which is on-demand, provisioned-concurrency, or snap-start.

For provisioned-concurrency it would also make sense to initialize the context earlier - therefore !("on-demand") would cover this as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahha, got it. will add

@deki deki merged commit 17afb9a into aws:main Apr 4, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants