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

Should invokeCount not be invokeTotal? #65

Open
Jimmy89 opened this issue Feb 9, 2024 · 1 comment
Open

Should invokeCount not be invokeTotal? #65

Jimmy89 opened this issue Feb 9, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@Jimmy89
Copy link

Jimmy89 commented Feb 9, 2024

If you look at line 106 where is being checked whether a delay must be triggered within the lambda, the code looks at invokeCount, which increases for every invoke. I think this should be invokeCount >= invokeTotal, as otherwise only the first lambda that is called will be delayed, while all up following lambda triggers will have no delay (e.g. invokeTotal = 5, than invokeCount > 1 is true 4 times). In case invokeCount equals invokeTotal no delay is necessary.

Currently, this results into less lambda invokes that are warmed.

@naorpeled naorpeled self-assigned this Oct 3, 2024
@naorpeled naorpeled added the question Further information is requested label Oct 3, 2024
@naorpeled
Copy link
Collaborator

Hi,

Thanks for reaching out, and sorry for the delayed response.

Regarding line 106:

} else if (invokeCount > 1) {
  return delay(config.delay).then(() => true)
}

The condition invokeCount > 1 is intentional. The first invocation (invokeCount === 1) initiates the warming process without delay, while subsequent invocations (invokeCount > 1) introduce a delay to keep those Lambda instances warm.

Changing it to invokeCount >= invokeTotal would delay only the last invocation, leaving others unwarmed.

If Lambdas aren't being warmed as expected, it might be due to the default config.delay setting. Try increasing it to allow more time for warming.

Let me know if you have any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants