aws-lambda-dart-runtime icon indicating copy to clipboard operation
aws-lambda-dart-runtime copied to clipboard

Downside, everything must be marked async/await

Open dragonfax opened this issue 4 years ago • 2 comments

The whole program has to be instrumented with async/await. As everything must be waited for to properly complete before your lambda function handler returns. No events can be left on the event queue when your handler returns or they will non-deterministically fail.

AWS freezes the lambda process between lambda calls (which it identify is over when you return a response from your handler). Anything left going after that in the background will see a timejump to when the lambda is called next, and will see its in-use connections reset.

Ideally the framework would wait until the event queue is empty (remove the frameworks own events). But dart might not expose the ability to do this in its own API. So perhaps just line in the documentation to warn about this issue.

dragonfax avatar Oct 20 '20 06:10 dragonfax

BTW framework works great for me.

dragonfax avatar Oct 20 '20 06:10 dragonfax

Maybe a zone could be used to track that all the handlers created events are finished before returning the response to AWS

dragonfax avatar Oct 21 '20 17:10 dragonfax