-
Notifications
You must be signed in to change notification settings - Fork 474
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
Use ILambdaContext.RemainingTime to create a valid CancellationToken for AspNetCoreServer Requests #1561
Labels
feature-request
A feature should be added or improved.
module/aspnetcore-support
p2
This is a standard priority issue
queued
Comments
brianfeucht
added
feature-request
A feature should be added or improved.
needs-triage
This issue or PR still needs to be triaged.
labels
Aug 8, 2023
Needs review with the team. |
ashishdhingra
added
needs-review
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Aug 8, 2023
Sample implementation:
|
Here is my implementation of this. WARNING - Might have a bug with GC, see message from brianfeucht
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature-request
A feature should be added or improved.
module/aspnetcore-support
p2
This is a standard priority issue
queued
Describe the feature
Currently when a Lambda execution times out, a AspNetCore request continues to execute even if it is checking a CancellationToken parameter for cancellation.
This feature would create a new CancellationTokenSource using ILambdaContext.RemainingTime and request cancellation when remaining time reaches or nears zero. This would allow consumer code to cancel long running operations in a way that is more controlled. This would create similar functionality to how timeouts are handled in Kestrel and IIS
Use Case
Due to upstream concurrency limitations, we sometimes have a lambda AspNetCore request timeout. Since the CancellationToken passed into the request is never cancelled, we continue to try to execute retry requests in the background if a lambda is reused.
Proposed Solution
No response
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
Amazon.Lambda.AspNetCoreServer.Hosting 1.5.0
Targeted .NET Platform
net6.0
Operating System and version
AmazonLinux (Lambda)
The text was updated successfully, but these errors were encountered: