-
-
Notifications
You must be signed in to change notification settings - Fork 16
handler should probably require FnMut, not just FnOnce #21
Comments
Does Lambda document this? My naive assumption was that each lambda request / event would end up creating, at a minimum, a new process. |
https://docs.aws.amazon.com/lambda/latest/dg/lambda-introduction.html
In a Python context, I've always taken this to mean that the |
See also #4 where it was discovered that lazy_static can be used to keep things around between invocations. |
@softprops do you have any thoughts about this issue? I'm debating whether I fix this for the 0.3.0 release or not still. |
I think this is fine as is I've been using lazy static and thread local https://github.com/meetup/pulley/blob/master/src/lib.rs#L67 In general it's best to initialize expensive ops like this for performance in lambda. For cheap initialization, do it inside the handler and pass state as arguments. |
If you're looking to cut a new release I've got one change I'd like to get in. An setup ergonomic issue I recently solved for lando, an extension of crowbar for the http crate softprops/lando#24 this removes the need for users to declare a cpython dependency I'm cargo.toml and lib.rs files by reexporting macros. I've been following along with the rust topics on enabling this softprops/lando#7 |
I'll try to follow up with a crowbar pull today and you can let me know what you think |
Im actually going to open a new issue on this one realizing the context is going to get lost in an unrelated thread :) |
carrying on over here #45 |
In this function signature:
https://github.com/ilianaw/rust-crowbar/blob/0b1b1b72308faa6f0c176a8e9f5ef061dea4a951/src/lib.rs#L242-L250
FnOnce does not imply that the provided function can be called multiple times, which is an assumption made by Lambda. Perhaps FnMut is more appropriate?
The text was updated successfully, but these errors were encountered: